ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_maillage.cpp
Revision: 842
Committed: Fri Oct 14 19:18:28 2016 UTC (8 years, 10 months ago) by nana
File size: 94148 byte(s)
Log Message:
Modif commit precedent

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_segment2.h"
34 #include "fem_mini_segment2.h"
35 #include "fem_segment3.h"
36 #include "fem_triangle3.h"
37 #include "fem_triangle6.h"
38 #include "fem_quadrangle4.h"
39 #include "fem_quadrangle8.h"
40 #include "fem_tetra4.h"
41 #include "fem_tetra10.h"
42 #include "fem_hexa8.h"
43 #include "fem_hexa20.h"
44 #include "fem_graph_noeud.h"
45 #include "mg_gestionnaire.h"
46 #include "mc_gestionnaire.h"
47 #include "mc_propriete.h"
48 #include "mc_materiau.h"
49 #include "ot_decalage_parametre.h"
50 #include "tpl_map_entite.h"
51 #include "tpl_liste_entite.h"
52 #include "fem_maillage_quadratique_outils.h"
53 //#include "message.h"
54
55
56
57 FEM_MAILLAGE::FEM_MAILLAGE(MG_GEOMETRIE* geo,MG_MAILLAGE* mai,int deg):MG_IDENTIFICATEUR(),mg_geometrie(geo),maillage(mai),degre(deg),deforme(0),reaction(0),est_structure(false)
58 {
59 }
60
61 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),reaction(0),est_structure(false)
62 {
63 }
64
65 FEM_MAILLAGE::~FEM_MAILLAGE()
66 {
67 supprimer_tout_xfem_element3();
68 supprimer_tout_fem_element3();
69 supprimer_tout_fem_element2();
70 supprimer_tout_fem_element1();
71 supprimer_tout_fem_noeud();
72 }
73
74 FEM_MAILLAGE* FEM_MAILLAGE::dupliquer(MG_GESTIONNAIRE* gest)
75 {
76 FEM_MAILLAGE* mai=new FEM_MAILLAGE(mg_geometrie,maillage,degre);
77 gest->ajouter_fem_maillage(mai);
78 long decalage=mai->get_id()-this->get_id();
79 LISTE_ENTITE::const_iterator i;
80 for (i=lst_entite.begin();i!=lst_entite.end();i++)
81 {
82 FEM_ELEMENT_MAILLAGE& ele=(FEM_ELEMENT_MAILLAGE&)(*(*i));
83 ele.dupliquer(mai,decalage);
84 }
85 return mai;
86 }
87
88 MG_GEOMETRIE* FEM_MAILLAGE::get_mg_geometrie(void)
89 {
90 return mg_geometrie;
91 }
92
93 MG_MAILLAGE* FEM_MAILLAGE::get_mg_maillage(void)
94 {
95 return maillage;
96 }
97
98 int FEM_MAILLAGE::get_degre(void)
99 {
100 return degre;
101 }
102
103 bool FEM_MAILLAGE::contient ( MG_IDENTIFICATEUR * id )
104 {
105 return ( lst_entite.find ( id ) != lst_entite.end() );
106 }
107
108 void FEM_MAILLAGE::change_gestionnaire(MG_GESTIONNAIRE* mggest)
109 {
110 gest=mggest;
111 }
112
113 // ENTITE FEM_NOEUD
114 FEM_NOEUD* FEM_MAILLAGE::ajouter_fem_noeud(MG_NOEUD* mgnoeud,unsigned long num)
115 {
116 FEM_NOEUD* femnoeud;
117 if (num==0) femnoeud=new FEM_NOEUD(mgnoeud);
118 else femnoeud=new FEM_NOEUD(num,mgnoeud);
119 int resultat = ajouter_fem_noeud(femnoeud);
120 if (resultat==FAIL)
121 {
122 delete femnoeud;
123 return NULL;
124 }
125 return femnoeud;
126 }
127
128 int FEM_MAILLAGE::ajouter_fem_noeud(FEM_NOEUD *femnoeud)
129 {
130 gest->recherche_bonid(*femnoeud);
131 MG_IDENTIFICATEUR *id=femnoeud;
132 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
133 if (!p.second)
134 {
135 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
136 return FAIL;
137 }
138
139 std::pair<const unsigned long,FEM_NOEUD*> tmp(femnoeud->get_id(),femnoeud);
140 lst_fem_noeud.insert(tmp);
141 return OK;
142 }
143
144
145 FEM_NOEUD* FEM_MAILLAGE::get_fem_noeudid(unsigned long num)
146 {
147 LISTE_FEM_NOEUD::iterator i=lst_fem_noeud.find(num);
148 if (i==lst_fem_noeud.end())
149 {
150 // afficheur << INEXISTE << enderr;
151 return NULL;
152 }
153 return ((*i).second);
154 }
155
156
157
158 FEM_NOEUD* FEM_MAILLAGE::get_fem_noeud(unsigned int num)
159 {
160 if (!(num<lst_fem_noeud.size()))
161 {
162 // afficheur << INEXISTE << enderr;
163 return NULL;
164 }
165 LISTE_FEM_NOEUD::iterator i = lst_fem_noeud.begin();
166 std::advance(i, num);
167
168 return ((*i).second);
169 }
170
171 FEM_NOEUD* FEM_MAILLAGE::get_premier_noeud(LISTE_FEM_NOEUD::iterator & it)
172 {
173 it = lst_fem_noeud.begin();
174 if (it == lst_fem_noeud.end())
175 return NULL;
176 return it->second ;
177 }
178
179 FEM_NOEUD* FEM_MAILLAGE::get_suivant_noeud(LISTE_FEM_NOEUD::iterator & it)
180 {
181 it++;
182 if (it==lst_fem_noeud.end())
183 return NULL;
184 return it->second;
185 }
186
187 unsigned int FEM_MAILLAGE::get_nb_fem_noeud(void)
188 {
189 return lst_fem_noeud.size();
190 }
191
192
193 int FEM_MAILLAGE::supprimer_fem_noeudid(unsigned long num)
194 {
195 FEM_NOEUD* femnoeud=get_fem_noeudid(num);
196 if (femnoeud==NULL)
197 {
198 // afficheur << INEXISTE2 << enderr;
199 return FAIL;
200 }
201 MG_IDENTIFICATEUR* id=femnoeud;
202 LISTE_ENTITE::iterator i=lst_entite.find(id);
203 lst_entite.erase(i);
204 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.find(num);
205 lst_fem_noeud.erase(j);
206 delete femnoeud;
207 return OK;
208 }
209
210
211 int FEM_MAILLAGE::supprimer_fem_noeud(unsigned int num)
212 {
213 FEM_NOEUD* femnoeud=get_fem_noeud(num);
214 if (femnoeud==NULL)
215 {
216 // afficheur << INEXISTE2 << enderr;
217 return FAIL;
218 }
219 MG_IDENTIFICATEUR* id=femnoeud;
220 LISTE_ENTITE::iterator i=lst_entite.find(id);
221 lst_entite.erase(i);
222 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.begin();
223 for (unsigned int k=0;k<num;k++) j++;
224 lst_fem_noeud.erase(j);
225 delete femnoeud;
226 return OK;
227 }
228
229
230 void FEM_MAILLAGE::supprimer_tout_fem_noeud(void)
231 {
232 while (get_nb_fem_noeud()!=0)
233 {
234 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.begin();
235 FEM_NOEUD* femnoeud=(*j).second;
236 MG_IDENTIFICATEUR* id=femnoeud;
237 LISTE_ENTITE::iterator i=lst_entite.find(id);
238 lst_entite.erase(i);
239 lst_fem_noeud.erase(j);
240 delete femnoeud;
241 }
242 }
243 // ENTITE FEM_ELEMENT0
244
245
246 int FEM_MAILLAGE::ajouter_fem_element0(FEM_ELEMENT0 *femnoeud)
247 {
248 gest->recherche_bonid(*femnoeud);
249 MG_IDENTIFICATEUR *id=femnoeud;
250 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
251 if (!p.second)
252 {
253 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
254 return FAIL;
255 }
256
257 std::pair<const unsigned long,FEM_ELEMENT0*> tmp(femnoeud->get_id(),femnoeud);
258 lst_fem_element0.insert(tmp);
259 return OK;
260 }
261
262 FEM_ELEMENT0* FEM_MAILLAGE::get_fem_element0id(unsigned long num)
263 {
264 LISTE_FEM_ELEMENT0::iterator i=lst_fem_element0.find(num);
265 if (i==lst_fem_element0.end())
266 {
267 // afficheur << INEXISTE << enderr;
268 return NULL;
269 }
270 return ((*i).second);
271 }
272
273 unsigned int FEM_MAILLAGE::get_nb_fem_element0(void)
274 {
275 return lst_fem_element0.size();
276 }
277
278
279
280 FEM_ELEMENT0* FEM_MAILLAGE::get_fem_element0(unsigned int num)
281 {
282 if (!(num<lst_fem_element0.size()))
283 {
284 // afficheur << INEXISTE << enderr;
285 return NULL;
286 }
287 LISTE_FEM_ELEMENT0::iterator i=lst_fem_element0.begin();
288 for (unsigned long j=0;j<num;j++) i++;
289 return ((*i).second);
290 }
291
292
293
294 int FEM_MAILLAGE::supprimer_fem_element0id(unsigned long num)
295 {
296 FEM_ELEMENT0* fem=get_fem_element0id(num);
297 if (fem==NULL)
298 {
299 // afficheur << INEXISTE2 << enderr;
300 return FAIL;
301 }
302 MG_IDENTIFICATEUR* id=fem;
303 LISTE_ENTITE::iterator i=lst_entite.find(id);
304 lst_entite.erase(i);
305 LISTE_FEM_ELEMENT0::iterator j=lst_fem_element0.find(num);
306 lst_fem_element0.erase(j);
307 delete fem;
308 return OK;
309 }
310
311 int FEM_MAILLAGE::supprimer_fem_element0(unsigned int num)
312 {
313 FEM_ELEMENT0* fem=get_fem_element0(num);
314 if (fem==NULL)
315 {
316 // afficheur << INEXISTE2 << enderr;
317 return FAIL;
318 }
319 MG_IDENTIFICATEUR* id=fem;
320 LISTE_ENTITE::iterator i=lst_entite.find(id);
321 lst_entite.erase(i);
322 LISTE_FEM_ELEMENT0::iterator j=lst_fem_element0.find(num);
323 lst_fem_element0.erase(j);
324 delete fem;
325 return OK;
326 }
327
328 void FEM_MAILLAGE::supprimer_tout_fem_element0(void)
329 {
330 while (get_nb_fem_element0()!=0)
331 {
332 LISTE_FEM_ELEMENT0::iterator j=lst_fem_element0.begin();
333 FEM_ELEMENT0* fem=(*j).second;
334 MG_IDENTIFICATEUR* id=fem;
335 LISTE_ENTITE::iterator i=lst_entite.find(id);
336 lst_entite.erase(i);
337 lst_fem_element0.erase(j);
338 delete fem;
339 }
340 }
341
342
343 FEM_ELEMENT0* FEM_MAILLAGE::get_premier_element0(LISTE_FEM_ELEMENT0::iterator & it)
344 {
345 it = lst_fem_element0.begin();
346 if (it == lst_fem_element0.end())
347 return NULL;
348 return it->second ;
349 }
350
351 FEM_ELEMENT0* FEM_MAILLAGE::get_suivant_element0(LISTE_FEM_ELEMENT0::iterator & it)
352 {
353 it++;
354 if (it==lst_fem_element0.end())
355 return NULL;
356 return it->second;
357 }
358
359
360 // ENTITE FEM_ELEMENT1
361
362
363 int FEM_MAILLAGE::ajouter_fem_element1(FEM_ELEMENT1 *femsegment)
364 {
365 gest->recherche_bonid(*femsegment);
366 MG_IDENTIFICATEUR *id=femsegment;
367 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
368 if (!p.second)
369 {
370 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
371 return FAIL;
372 }
373
374 std::pair<const unsigned long,FEM_ELEMENT1*> tmp(femsegment->get_id(),femsegment);
375 lst_fem_element1.insert(tmp);
376 return OK;
377 }
378
379 FEM_ELEMENT1* FEM_MAILLAGE::get_fem_element1id(unsigned long num)
380 {
381 LISTE_FEM_ELEMENT1::iterator i=lst_fem_element1.find(num);
382 if (i==lst_fem_element1.end())
383 {
384 // afficheur << INEXISTE << enderr;
385 return NULL;
386 }
387 return ((*i).second);
388 }
389
390 unsigned int FEM_MAILLAGE::get_nb_fem_element1(void)
391 {
392 return lst_fem_element1.size();
393 }
394
395
396
397 FEM_ELEMENT1* FEM_MAILLAGE::get_fem_element1(unsigned int num)
398 {
399 if (!(num<lst_fem_element1.size()))
400 {
401 // afficheur << INEXISTE << enderr;
402 return NULL;
403 }
404 LISTE_FEM_ELEMENT1::iterator i=lst_fem_element1.begin();
405 for (unsigned long j=0;j<num;j++) i++;
406 return ((*i).second);
407 }
408
409
410
411 int FEM_MAILLAGE::supprimer_fem_element1id(unsigned long num)
412 {
413 FEM_ELEMENT1* femsegment=get_fem_element1id(num);
414 if (femsegment==NULL)
415 {
416 // afficheur << INEXISTE2 << enderr;
417 return FAIL;
418 }
419 MG_IDENTIFICATEUR* id=femsegment;
420 LISTE_ENTITE::iterator i=lst_entite.find(id);
421 lst_entite.erase(i);
422 LISTE_FEM_ELEMENT1::iterator j=lst_fem_element1.find(num);
423 lst_fem_element1.erase(j);
424 delete femsegment;
425 return OK;
426 }
427
428 int FEM_MAILLAGE::supprimer_fem_element1(unsigned int num)
429 {
430 FEM_ELEMENT1* femsegment=get_fem_element1(num);
431 if (femsegment==NULL)
432 {
433 // afficheur << INEXISTE2 << enderr;
434 return FAIL;
435 }
436 MG_IDENTIFICATEUR* id=femsegment;
437 LISTE_ENTITE::iterator i=lst_entite.find(id);
438 lst_entite.erase(i);
439 LISTE_FEM_ELEMENT1::iterator j=lst_fem_element1.find(num);
440 lst_fem_element1.erase(j);
441 delete femsegment;
442 return OK;
443 }
444
445 void FEM_MAILLAGE::supprimer_tout_fem_element1(void)
446 {
447 while (get_nb_fem_element1()!=0)
448 {
449 LISTE_FEM_ELEMENT1::iterator j=lst_fem_element1.begin();
450 FEM_ELEMENT1* femsegment=(*j).second;
451 MG_IDENTIFICATEUR* id=femsegment;
452 LISTE_ENTITE::iterator i=lst_entite.find(id);
453 lst_entite.erase(i);
454 lst_fem_element1.erase(j);
455 delete femsegment;
456 }
457 }
458
459
460 FEM_ELEMENT1* FEM_MAILLAGE::get_premier_element1(LISTE_FEM_ELEMENT1::iterator & it)
461 {
462 it = lst_fem_element1.begin();
463 if (it == lst_fem_element1.end())
464 return NULL;
465 return it->second ;
466 }
467
468 FEM_ELEMENT1* FEM_MAILLAGE::get_suivant_element1(LISTE_FEM_ELEMENT1::iterator & it)
469 {
470 it++;
471 if (it==lst_fem_element1.end())
472 return NULL;
473 return it->second;
474 }
475
476
477
478 // ENTITE FEM_ELEMENT2
479
480
481 int FEM_MAILLAGE::ajouter_fem_element2(FEM_ELEMENT2 *femtriangle)
482 {
483 gest->recherche_bonid(*femtriangle);
484 MG_IDENTIFICATEUR *id=femtriangle;
485 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
486 if (!p.second)
487 {
488 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
489 return FAIL;
490 }
491
492 std::pair<const unsigned long,FEM_ELEMENT2*> tmp(femtriangle->get_id(),femtriangle);
493 lst_fem_element2.insert(tmp);
494 return OK;
495 }
496
497 FEM_ELEMENT2* FEM_MAILLAGE::get_fem_element2id(unsigned long num)
498 {
499 LISTE_FEM_ELEMENT2::iterator i=lst_fem_element2.find(num);
500 if (i==lst_fem_element2.end())
501 {
502 // afficheur << INEXISTE << enderr;
503 return NULL;
504 }
505 return ((*i).second);
506 }
507
508 unsigned int FEM_MAILLAGE::get_nb_fem_element2(void)
509 {
510 return lst_fem_element2.size();
511 }
512
513
514
515 FEM_ELEMENT2* FEM_MAILLAGE::get_fem_element2(unsigned int num)
516 {
517 if (!(num<lst_fem_element2.size()))
518 {
519 // afficheur << INEXISTE << enderr;
520 return NULL;
521 }
522 LISTE_FEM_ELEMENT2::iterator i=lst_fem_element2.begin();
523 for (unsigned long j=0;j<num;j++) i++;
524 return ((*i).second);
525 }
526
527
528
529 int FEM_MAILLAGE::supprimer_fem_element2id(unsigned long num)
530 {
531 FEM_ELEMENT2* femtriangle=get_fem_element2id(num);
532 if (femtriangle==NULL)
533 {
534 // afficheur << INEXISTE2 << enderr;
535 return FAIL;
536 }
537 MG_IDENTIFICATEUR* id=femtriangle;
538 LISTE_ENTITE::iterator i=lst_entite.find(id);
539 lst_entite.erase(i);
540 LISTE_FEM_ELEMENT2::iterator j=lst_fem_element2.find(num);
541 lst_fem_element2.erase(j);
542 delete femtriangle;
543 return OK;
544 }
545
546 int FEM_MAILLAGE::supprimer_fem_element2(unsigned int num)
547 {
548 FEM_ELEMENT2* femtriangle=get_fem_element2(num);
549 if (femtriangle==NULL)
550 {
551 // afficheur << INEXISTE2 << enderr;
552 return FAIL;
553 }
554 MG_IDENTIFICATEUR* id=femtriangle;
555 LISTE_ENTITE::iterator i=lst_entite.find(id);
556 lst_entite.erase(i);
557 LISTE_FEM_ELEMENT2::iterator j=lst_fem_element2.find(num);
558 lst_fem_element2.erase(j);
559 delete femtriangle;
560 return OK;
561 }
562
563 void FEM_MAILLAGE::supprimer_tout_fem_element2(void)
564 {
565 while (get_nb_fem_element2()!=0)
566 {
567 LISTE_FEM_ELEMENT2::iterator j=lst_fem_element2.begin();
568 FEM_ELEMENT2* femtriangle=(*j).second;
569 MG_IDENTIFICATEUR* id=femtriangle;
570 LISTE_ENTITE::iterator i=lst_entite.find(id);
571 lst_entite.erase(i);
572 lst_fem_element2.erase(j);
573 delete femtriangle;
574 }
575 }
576
577
578 FEM_ELEMENT2* FEM_MAILLAGE::get_premier_element2(LISTE_FEM_ELEMENT2::iterator & it)
579 {
580 it = lst_fem_element2.begin();
581 if (it == lst_fem_element2.end())
582 return NULL;
583 return it->second ;
584 }
585
586 FEM_ELEMENT2* FEM_MAILLAGE::get_suivant_element2(LISTE_FEM_ELEMENT2::iterator & it)
587 {
588 it++;
589 if (it==lst_fem_element2.end())
590 return NULL;
591 return it->second;
592 }
593
594
595 // ENTITE FEM_TETRA
596
597
598 int FEM_MAILLAGE::ajouter_fem_element3(FEM_ELEMENT3 *femele)
599 {
600 gest->recherche_bonid(*femele);
601 MG_IDENTIFICATEUR *id=femele;
602 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
603 if (!p.second)
604 {
605 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
606 return FAIL;
607 }
608
609 std::pair<const unsigned long,FEM_ELEMENT3*> tmp(femele->get_id(),femele);
610 lst_fem_element3.insert(tmp);
611 return OK;
612 }
613
614 FEM_ELEMENT3* FEM_MAILLAGE::get_fem_element3id(unsigned long num)
615 {
616 LISTE_FEM_ELEMENT3::iterator i=lst_fem_element3.find(num);
617 if (i==lst_fem_element3.end())
618 {
619 // afficheur << INEXISTE << enderr;
620 return NULL;
621 }
622 return ((*i).second);
623 }
624
625 unsigned int FEM_MAILLAGE::get_nb_fem_element3(void)
626 {
627 return lst_fem_element3.size();
628 }
629
630
631
632 FEM_ELEMENT3* FEM_MAILLAGE::get_fem_element3(unsigned int num)
633 {
634 if (!(num<lst_fem_element3.size()))
635 {
636 // afficheur << INEXISTE << enderr;
637 return NULL;
638 }
639 LISTE_FEM_ELEMENT3::iterator i=lst_fem_element3.begin();
640 for (unsigned long j=0;j<num;j++) i++;
641 return ((*i).second);
642 }
643
644
645
646 int FEM_MAILLAGE::supprimer_fem_element3id(unsigned long num)
647 {
648 FEM_ELEMENT3* femele=get_fem_element3id(num);
649 if (femele==NULL)
650 {
651 // afficheur << INEXISTE2 << enderr;
652 return FAIL;
653 }
654 MG_IDENTIFICATEUR* id=femele;
655 LISTE_ENTITE::iterator i=lst_entite.find(id);
656 lst_entite.erase(i);
657 LISTE_FEM_ELEMENT3::iterator j=lst_fem_element3.find(num);
658 lst_fem_element3.erase(j);
659 delete femele;
660 return OK;
661 }
662
663 int FEM_MAILLAGE::supprimer_fem_element3(unsigned int num)
664 {
665 FEM_ELEMENT3* femele=get_fem_element3(num);
666 if (femele==NULL)
667 {
668 // afficheur << INEXISTE2 << enderr;
669 return FAIL;
670 }
671 MG_IDENTIFICATEUR* id=femele;
672 LISTE_ENTITE::iterator i=lst_entite.find(id);
673 lst_entite.erase(i);
674 LISTE_FEM_ELEMENT3::iterator j=lst_fem_element3.find(num);
675 lst_fem_element3.erase(j);
676 delete femele;
677 return OK;
678 }
679
680 void FEM_MAILLAGE::supprimer_tout_fem_element3(void)
681 {
682 while (get_nb_fem_element3()!=0)
683 {
684 LISTE_FEM_ELEMENT3::iterator j=lst_fem_element3.begin();
685 FEM_ELEMENT3* femele=(*j).second;
686 MG_IDENTIFICATEUR* id=femele;
687 LISTE_ENTITE::iterator i=lst_entite.find(id);
688 lst_entite.erase(i);
689 lst_fem_element3.erase(j);
690 delete femele;
691 }
692 }
693
694
695 FEM_ELEMENT3* FEM_MAILLAGE::get_premier_element3(LISTE_FEM_ELEMENT3::iterator & it)
696 {
697 it = lst_fem_element3.begin();
698 if (it == lst_fem_element3.end())
699 return NULL;
700 return it->second ;
701 }
702
703 FEM_ELEMENT3* FEM_MAILLAGE::get_suivant_element3(LISTE_FEM_ELEMENT3::iterator & it)
704 {
705 it++;
706 if (it==lst_fem_element3.end())
707 return NULL;
708 return it->second;
709 }
710
711 // ENTITE XFEM_ELEMENT0
712
713
714 int FEM_MAILLAGE::ajouter_xfem_element0(XFEM_ELEMENT0 *femele)
715 {
716 gest->recherche_bonid(*femele);
717 MG_IDENTIFICATEUR *id=femele;
718 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
719 if (!p.second)
720 {
721 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
722 return FAIL;
723 }
724
725 std::pair<const unsigned long,XFEM_ELEMENT0*> tmp(femele->get_id(),femele);
726 lst_xfem_element0.insert(tmp);
727 return OK;
728 }
729
730 XFEM_ELEMENT0* FEM_MAILLAGE::get_xfem_element0id(unsigned long num)
731 {
732 LISTE_XFEM_ELEMENT0::iterator i=lst_xfem_element0.find(num);
733 if (i==lst_xfem_element0.end())
734 {
735 // afficheur << INEXISTE << enderr;
736 return NULL;
737 }
738 return ((*i).second);
739 }
740
741 unsigned int FEM_MAILLAGE::get_nb_xfem_element0(void)
742 {
743 return lst_xfem_element0.size();
744 }
745
746
747
748 XFEM_ELEMENT0* FEM_MAILLAGE::get_xfem_element0(unsigned int num)
749 {
750 if (!(num<lst_xfem_element0.size()))
751 {
752 // afficheur << INEXISTE << enderr;
753 return NULL;
754 }
755 LISTE_XFEM_ELEMENT0::iterator i=lst_xfem_element0.begin();
756 for (unsigned long j=0;j<num;j++) i++;
757 return ((*i).second);
758 }
759
760
761
762 int FEM_MAILLAGE::supprimer_xfem_element0id(unsigned long num)
763 {
764 XFEM_ELEMENT0* femele=get_xfem_element0id(num);
765 if (femele==NULL)
766 {
767 // afficheur << INEXISTE2 << enderr;
768 return FAIL;
769 }
770 MG_IDENTIFICATEUR* id=femele;
771 LISTE_ENTITE::iterator i=lst_entite.find(id);
772 lst_entite.erase(i);
773 LISTE_XFEM_ELEMENT0::iterator j=lst_xfem_element0.find(num);
774 lst_xfem_element0.erase(j);
775 delete femele;
776 return OK;
777 }
778
779 int FEM_MAILLAGE::supprimer_xfem_element0(unsigned int num)
780 {
781 XFEM_ELEMENT0* femele=get_xfem_element0(num);
782 if (femele==NULL)
783 {
784 // afficheur << INEXISTE2 << enderr;
785 return FAIL;
786 }
787 MG_IDENTIFICATEUR* id=femele;
788 LISTE_ENTITE::iterator i=lst_entite.find(id);
789 lst_entite.erase(i);
790 LISTE_XFEM_ELEMENT0::iterator j=lst_xfem_element0.find(num);
791 lst_xfem_element0.erase(j);
792 delete femele;
793 return OK;
794 }
795
796 void FEM_MAILLAGE::supprimer_tout_xfem_element0(void)
797 {
798 while (get_nb_xfem_element0()!=0)
799 {
800 LISTE_XFEM_ELEMENT0::iterator j=lst_xfem_element0.begin();
801 XFEM_ELEMENT0* femele=(*j).second;
802 MG_IDENTIFICATEUR* id=femele;
803 LISTE_ENTITE::iterator i=lst_entite.find(id);
804 lst_entite.erase(i);
805 lst_xfem_element0.erase(j);
806 delete femele;
807 }
808 }
809
810
811 XFEM_ELEMENT0* FEM_MAILLAGE::get_premier_xelement0(LISTE_XFEM_ELEMENT0::iterator & it)
812 {
813 it = lst_xfem_element0.begin();
814 if (it == lst_xfem_element0.end())
815 return NULL;
816 return it->second ;
817 }
818
819 XFEM_ELEMENT0* FEM_MAILLAGE::get_suivant_xelement0(LISTE_XFEM_ELEMENT0::iterator & it)
820 {
821 it++;
822 if (it==lst_xfem_element0.end())
823 return NULL;
824 return it->second;
825 }
826
827
828 // ENTITE XFEM_ELEMENT1
829
830
831 int FEM_MAILLAGE::ajouter_xfem_element1(XFEM_ELEMENT1 *femele)
832 {
833 gest->recherche_bonid(*femele);
834 MG_IDENTIFICATEUR *id=femele;
835 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
836 if (!p.second)
837 {
838 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
839 return FAIL;
840 }
841
842 std::pair<const unsigned long,XFEM_ELEMENT1*> tmp(femele->get_id(),femele);
843 lst_xfem_element1.insert(tmp);
844 return OK;
845 }
846
847 XFEM_ELEMENT1* FEM_MAILLAGE::get_xfem_element1id(unsigned long num)
848 {
849 LISTE_XFEM_ELEMENT1::iterator i=lst_xfem_element1.find(num);
850 if (i==lst_xfem_element1.end())
851 {
852 // afficheur << INEXISTE << enderr;
853 return NULL;
854 }
855 return ((*i).second);
856 }
857
858 unsigned int FEM_MAILLAGE::get_nb_xfem_element1(void)
859 {
860 return lst_xfem_element1.size();
861 }
862
863
864
865 XFEM_ELEMENT1* FEM_MAILLAGE::get_xfem_element1(unsigned int num)
866 {
867 if (!(num<lst_xfem_element1.size()))
868 {
869 // afficheur << INEXISTE << enderr;
870 return NULL;
871 }
872 LISTE_XFEM_ELEMENT1::iterator i=lst_xfem_element1.begin();
873 for (unsigned long j=0;j<num;j++) i++;
874 return ((*i).second);
875 }
876
877
878
879 int FEM_MAILLAGE::supprimer_xfem_element1id(unsigned long num)
880 {
881 XFEM_ELEMENT1* femele=get_xfem_element1id(num);
882 if (femele==NULL)
883 {
884 // afficheur << INEXISTE2 << enderr;
885 return FAIL;
886 }
887 MG_IDENTIFICATEUR* id=femele;
888 LISTE_ENTITE::iterator i=lst_entite.find(id);
889 lst_entite.erase(i);
890 LISTE_XFEM_ELEMENT1::iterator j=lst_xfem_element1.find(num);
891 lst_xfem_element1.erase(j);
892 delete femele;
893 return OK;
894 }
895
896 int FEM_MAILLAGE::supprimer_xfem_element1(unsigned int num)
897 {
898 XFEM_ELEMENT1* femele=get_xfem_element1(num);
899 if (femele==NULL)
900 {
901 // afficheur << INEXISTE2 << enderr;
902 return FAIL;
903 }
904 MG_IDENTIFICATEUR* id=femele;
905 LISTE_ENTITE::iterator i=lst_entite.find(id);
906 lst_entite.erase(i);
907 LISTE_XFEM_ELEMENT1::iterator j=lst_xfem_element1.find(num);
908 lst_xfem_element1.erase(j);
909 delete femele;
910 return OK;
911 }
912
913 void FEM_MAILLAGE::supprimer_tout_xfem_element1(void)
914 {
915 while (get_nb_xfem_element1()!=0)
916 {
917 LISTE_XFEM_ELEMENT1::iterator j=lst_xfem_element1.begin();
918 XFEM_ELEMENT1* femele=(*j).second;
919 MG_IDENTIFICATEUR* id=femele;
920 LISTE_ENTITE::iterator i=lst_entite.find(id);
921 lst_entite.erase(i);
922 lst_xfem_element1.erase(j);
923 delete femele;
924 }
925 }
926
927
928 XFEM_ELEMENT1* FEM_MAILLAGE::get_premier_xelement1(LISTE_XFEM_ELEMENT1::iterator & it)
929 {
930 it = lst_xfem_element1.begin();
931 if (it == lst_xfem_element1.end())
932 return NULL;
933 return it->second ;
934 }
935
936 XFEM_ELEMENT1* FEM_MAILLAGE::get_suivant_xelement1(LISTE_XFEM_ELEMENT1::iterator & it)
937 {
938 it++;
939 if (it==lst_xfem_element1.end())
940 return NULL;
941 return it->second;
942 }
943
944
945
946 // ENTITE XFEM_ELEMENT2
947
948
949 int FEM_MAILLAGE::ajouter_xfem_element2(XFEM_ELEMENT2 *femele)
950 {
951 gest->recherche_bonid(*femele);
952 MG_IDENTIFICATEUR *id=femele;
953 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
954 if (!p.second)
955 {
956 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
957 return FAIL;
958 }
959
960 std::pair<const unsigned long,XFEM_ELEMENT2*> tmp(femele->get_id(),femele);
961 lst_xfem_element2.insert(tmp);
962 return OK;
963 }
964
965 XFEM_ELEMENT2* FEM_MAILLAGE::get_xfem_element2id(unsigned long num)
966 {
967 LISTE_XFEM_ELEMENT2::iterator i=lst_xfem_element2.find(num);
968 if (i==lst_xfem_element2.end())
969 {
970 // afficheur << INEXISTE << enderr;
971 return NULL;
972 }
973 return ((*i).second);
974 }
975
976 unsigned int FEM_MAILLAGE::get_nb_xfem_element2(void)
977 {
978 return lst_xfem_element2.size();
979 }
980
981
982
983 XFEM_ELEMENT2* FEM_MAILLAGE::get_xfem_element2(unsigned int num)
984 {
985 if (!(num<lst_xfem_element2.size()))
986 {
987 // afficheur << INEXISTE << enderr;
988 return NULL;
989 }
990 LISTE_XFEM_ELEMENT2::iterator i=lst_xfem_element2.begin();
991 for (unsigned long j=0;j<num;j++) i++;
992 return ((*i).second);
993 }
994
995
996
997 int FEM_MAILLAGE::supprimer_xfem_element2id(unsigned long num)
998 {
999 XFEM_ELEMENT2* femele=get_xfem_element2id(num);
1000 if (femele==NULL)
1001 {
1002 // afficheur << INEXISTE2 << enderr;
1003 return FAIL;
1004 }
1005 MG_IDENTIFICATEUR* id=femele;
1006 LISTE_ENTITE::iterator i=lst_entite.find(id);
1007 lst_entite.erase(i);
1008 LISTE_XFEM_ELEMENT2::iterator j=lst_xfem_element2.find(num);
1009 lst_xfem_element2.erase(j);
1010 delete femele;
1011 return OK;
1012 }
1013
1014 int FEM_MAILLAGE::supprimer_xfem_element2(unsigned int num)
1015 {
1016 XFEM_ELEMENT2* femele=get_xfem_element2(num);
1017 if (femele==NULL)
1018 {
1019 // afficheur << INEXISTE2 << enderr;
1020 return FAIL;
1021 }
1022 MG_IDENTIFICATEUR* id=femele;
1023 LISTE_ENTITE::iterator i=lst_entite.find(id);
1024 lst_entite.erase(i);
1025 LISTE_XFEM_ELEMENT2::iterator j=lst_xfem_element2.find(num);
1026 lst_xfem_element2.erase(j);
1027 delete femele;
1028 return OK;
1029 }
1030
1031 void FEM_MAILLAGE::supprimer_tout_xfem_element2(void)
1032 {
1033 while (get_nb_xfem_element2()!=0)
1034 {
1035 LISTE_XFEM_ELEMENT2::iterator j=lst_xfem_element2.begin();
1036 XFEM_ELEMENT2* femele=(*j).second;
1037 MG_IDENTIFICATEUR* id=femele;
1038 LISTE_ENTITE::iterator i=lst_entite.find(id);
1039 lst_entite.erase(i);
1040 lst_xfem_element2.erase(j);
1041 delete femele;
1042 }
1043 }
1044
1045
1046 XFEM_ELEMENT2* FEM_MAILLAGE::get_premier_xelement2(LISTE_XFEM_ELEMENT2::iterator & it)
1047 {
1048 it = lst_xfem_element2.begin();
1049 if (it == lst_xfem_element2.end())
1050 return NULL;
1051 return it->second ;
1052 }
1053
1054 XFEM_ELEMENT2* FEM_MAILLAGE::get_suivant_xelement2(LISTE_XFEM_ELEMENT2::iterator & it)
1055 {
1056 it++;
1057 if (it==lst_xfem_element2.end())
1058 return NULL;
1059 return it->second;
1060 }
1061
1062
1063
1064 // ENTITE XFEM_ELEMENT3
1065
1066
1067 int FEM_MAILLAGE::ajouter_xfem_element3(XFEM_ELEMENT3 *femele)
1068 {
1069 gest->recherche_bonid(*femele);
1070 MG_IDENTIFICATEUR *id=femele;
1071 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
1072 if (!p.second)
1073 {
1074 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
1075 return FAIL;
1076 }
1077
1078 std::pair<const unsigned long,XFEM_ELEMENT3*> tmp(femele->get_id(),femele);
1079 lst_xfem_element3.insert(tmp);
1080 return OK;
1081 }
1082
1083 XFEM_ELEMENT3* FEM_MAILLAGE::get_xfem_element3id(unsigned long num)
1084 {
1085 LISTE_XFEM_ELEMENT3::iterator i=lst_xfem_element3.find(num);
1086 if (i==lst_xfem_element3.end())
1087 {
1088 // afficheur << INEXISTE << enderr;
1089 return NULL;
1090 }
1091 return ((*i).second);
1092 }
1093
1094 unsigned int FEM_MAILLAGE::get_nb_xfem_element3(void)
1095 {
1096 return lst_xfem_element3.size();
1097 }
1098
1099
1100
1101 XFEM_ELEMENT3* FEM_MAILLAGE::get_xfem_element3(unsigned int num)
1102 {
1103 if (!(num<lst_xfem_element3.size()))
1104 {
1105 // afficheur << INEXISTE << enderr;
1106 return NULL;
1107 }
1108 LISTE_XFEM_ELEMENT3::iterator i=lst_xfem_element3.begin();
1109 for (unsigned long j=0;j<num;j++) i++;
1110 return ((*i).second);
1111 }
1112
1113
1114
1115 int FEM_MAILLAGE::supprimer_xfem_element3id(unsigned long num)
1116 {
1117 XFEM_ELEMENT3* femele=get_xfem_element3id(num);
1118 if (femele==NULL)
1119 {
1120 // afficheur << INEXISTE2 << enderr;
1121 return FAIL;
1122 }
1123 MG_IDENTIFICATEUR* id=femele;
1124 LISTE_ENTITE::iterator i=lst_entite.find(id);
1125 lst_entite.erase(i);
1126 LISTE_XFEM_ELEMENT3::iterator j=lst_xfem_element3.find(num);
1127 lst_xfem_element3.erase(j);
1128 delete femele;
1129 return OK;
1130 }
1131
1132 int FEM_MAILLAGE::supprimer_xfem_element3(unsigned int num)
1133 {
1134 XFEM_ELEMENT3* femele=get_xfem_element3(num);
1135 if (femele==NULL)
1136 {
1137 // afficheur << INEXISTE2 << enderr;
1138 return FAIL;
1139 }
1140 MG_IDENTIFICATEUR* id=femele;
1141 LISTE_ENTITE::iterator i=lst_entite.find(id);
1142 lst_entite.erase(i);
1143 LISTE_XFEM_ELEMENT3::iterator j=lst_xfem_element3.find(num);
1144 lst_xfem_element3.erase(j);
1145 delete femele;
1146 return OK;
1147 }
1148
1149 void FEM_MAILLAGE::supprimer_tout_xfem_element3(void)
1150 {
1151 while (get_nb_xfem_element3()!=0)
1152 {
1153 LISTE_XFEM_ELEMENT3::iterator j=lst_xfem_element3.begin();
1154 XFEM_ELEMENT3* femele=(*j).second;
1155 MG_IDENTIFICATEUR* id=femele;
1156 LISTE_ENTITE::iterator i=lst_entite.find(id);
1157 lst_entite.erase(i);
1158 lst_xfem_element3.erase(j);
1159 delete femele;
1160 }
1161 }
1162
1163
1164 XFEM_ELEMENT3* FEM_MAILLAGE::get_premier_xelement3(LISTE_XFEM_ELEMENT3::iterator & it)
1165 {
1166 it = lst_xfem_element3.begin();
1167 if (it == lst_xfem_element3.end())
1168 return NULL;
1169 return it->second ;
1170 }
1171
1172 XFEM_ELEMENT3* FEM_MAILLAGE::get_suivant_xelement3(LISTE_XFEM_ELEMENT3::iterator & it)
1173 {
1174 it++;
1175 if (it==lst_xfem_element3.end())
1176 return NULL;
1177 return it->second;
1178 }
1179
1180
1181
1182 void FEM_MAILLAGE::construire(int num)
1183 {
1184 TPL_MAP_ENTITE<MG_SEGMENT*> mini;
1185 if (mg_geometrie!=NULL)
1186 if (mg_geometrie->get_nb_mg_poutre()!=0)
1187 if (mg_geometrie->get_nb_mg_volume()!=0)
1188 recherche_connexion_multidimension(mini);
1189 if (degre==1) construire_lineaire(mini);
1190 if (degre==2) construire_quadratique();
1191 if (num>0) optimise_numerotation();
1192 if (num>1) copie_numerotation_opt();
1193 BOITE_3D b;
1194 int nx,ny,nz;
1195 bool structure=maillage->get_param_structure(b,nx,ny,nz);
1196 if (structure==true)
1197 change_param_structure(b,nx,ny,nz);
1198
1199 }
1200
1201
1202
1203
1204 void FEM_MAILLAGE::construire_lineaire(TPL_MAP_ENTITE<MG_SEGMENT*> &mini)
1205 {
1206 LISTE_MG_NOEUD::iterator it_noeud;
1207 MG_NOEUD* mgnoeud=maillage->get_premier_noeud(it_noeud);
1208 std::vector<FEM_NOEUD*> lstnoeuddirect;
1209 unsigned int i=0;
1210 while (mgnoeud)
1211 {
1212 mgnoeud->change_nouveau_numero(i);
1213 FEM_NOEUD* femnoeud=new FEM_NOEUD(mgnoeud);
1214 femnoeud->change_numero(i+1);
1215 i++;
1216 ajouter_fem_noeud(femnoeud);
1217 lstnoeuddirect.insert(lstnoeuddirect.end(),femnoeud);
1218 if (mgnoeud->get_lien_topologie()!=NULL)
1219 if (mgnoeud->get_lien_topologie()->get_dimension()==0)
1220 {
1221 FEM_ELEMENT0* femele=new FEM_ELEMENT0(mgnoeud->get_lien_topologie(),mgnoeud,&femnoeud);
1222 ajouter_fem_element0(femele);
1223 }
1224 mgnoeud=maillage->get_suivant_noeud(it_noeud);
1225
1226 }
1227 int dimsansgeo=0;
1228 if (get_mg_geometrie()==NULL)
1229 {
1230 if (maillage->get_nb_mg_tetra()+maillage->get_nb_mg_hexa()!=0) dimsansgeo=3;
1231 else if (maillage->get_nb_mg_triangle()+maillage->get_nb_mg_quadrangle()!=0) dimsansgeo=2;
1232 else if (maillage->get_nb_mg_segment()!=0) dimsansgeo=1;
1233 }
1234 if (get_mg_geometrie()!=NULL)
1235 if (strcmp(get_mg_geometrie()->get_type_geometrie(),"VIRTUEL")==0)
1236 {
1237 if (maillage->get_nb_mg_tetra()+maillage->get_nb_mg_hexa()!=0) dimsansgeo=3;
1238 else if (maillage->get_nb_mg_triangle()+maillage->get_nb_mg_quadrangle()!=0) dimsansgeo=2;
1239 else if (maillage->get_nb_mg_segment()!=0) dimsansgeo=1;
1240 }
1241
1242 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==1)))
1243 {
1244 LISTE_MG_SEGMENT::iterator it_seg;
1245 MG_SEGMENT * mgseg = maillage->get_premier_segment(it_seg);
1246 while (mgseg)
1247 {
1248 if (mgseg->get_lien_topologie()!=NULL)
1249 if (mgseg->get_lien_topologie()->get_dimension()!=1)
1250 {
1251 mgseg=maillage->get_suivant_segment(it_seg);
1252 continue;
1253 }
1254 if (get_mg_geometrie()!=NULL)
1255 if (mgseg->get_lien_topologie()==NULL)
1256 if (dimsansgeo!=1)
1257 {
1258 mgseg=maillage->get_suivant_segment(it_seg);
1259 continue;
1260 }
1261 FEM_NOEUD *tabnoeud[2];
1262 tabnoeud[0]=lstnoeuddirect[mgseg->get_noeud1()->get_nouveau_numero()];
1263 tabnoeud[1]=lstnoeuddirect[mgseg->get_noeud2()->get_nouveau_numero()];
1264 FEM_SEGMENT2* seg=new FEM_SEGMENT2(mgseg,tabnoeud);
1265 ajouter_fem_element1(seg);
1266 mgseg=maillage->get_suivant_segment(it_seg);
1267 }
1268 TPL_MAP_ENTITE<MG_SEGMENT*>::ITERATEUR itm;
1269 for (MG_SEGMENT* mgseg=mini.get_premier(itm);mgseg!=NULL;mgseg=mini.get_suivant(itm))
1270 {
1271 FEM_NOEUD *tabnoeud[2];
1272 tabnoeud[0]=lstnoeuddirect[mgseg->get_noeud1()->get_nouveau_numero()];
1273 tabnoeud[1]=lstnoeuddirect[mgseg->get_noeud2()->get_nouveau_numero()];
1274 FEM_SEGMENT2* seg=new FEM_MINI_SEGMENT2(mgseg,tabnoeud);
1275 ajouter_fem_element1(seg);
1276 }
1277 }
1278 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==2)))
1279 {
1280 LISTE_MG_TRIANGLE::iterator it_tri;
1281 MG_TRIANGLE* mgtri=maillage->get_premier_triangle(it_tri);
1282 while (mgtri)
1283 {
1284 if (mgtri->get_lien_topologie()!=NULL) if (mgtri->get_lien_topologie()->get_dimension()!=2)
1285 {
1286 mgtri=maillage->get_suivant_triangle(it_tri);
1287 continue;
1288 }
1289 if (get_mg_geometrie()!=NULL)
1290 if (mgtri->get_lien_topologie()==NULL)
1291 if (dimsansgeo!=2)
1292 {
1293 mgtri=maillage->get_suivant_triangle(it_tri);
1294 continue;
1295 }
1296 FEM_NOEUD *tabnoeud[3];
1297 tabnoeud[0]=lstnoeuddirect[mgtri->get_noeud1()->get_nouveau_numero()];
1298 tabnoeud[1]=lstnoeuddirect[mgtri->get_noeud2()->get_nouveau_numero()];
1299 tabnoeud[2]=lstnoeuddirect[mgtri->get_noeud3()->get_nouveau_numero()];
1300 FEM_TRIANGLE3* tri=new FEM_TRIANGLE3(mgtri,tabnoeud);
1301 ajouter_fem_element2(tri);
1302 mgtri=maillage->get_suivant_triangle(it_tri);
1303 }
1304 LISTE_MG_QUADRANGLE::iterator it_quad;
1305 MG_QUADRANGLE* mgquad=maillage->get_premier_quadrangle(it_quad);
1306 while (mgquad)
1307 {
1308 if (mgquad->get_lien_topologie()!=NULL) if (mgquad->get_lien_topologie()->get_dimension()!=2) {
1309 mgquad=maillage->get_suivant_quadrangle(it_quad);
1310 continue;
1311 }
1312 if (get_mg_geometrie()!=NULL)
1313 if (mgquad->get_lien_topologie()==NULL)
1314 if (dimsansgeo!=2)
1315 {
1316 mgquad=maillage->get_suivant_quadrangle(it_quad);
1317 continue;
1318 }
1319 FEM_NOEUD *tabnoeud[4];
1320 tabnoeud[0]=lstnoeuddirect[mgquad->get_noeud1()->get_nouveau_numero()];
1321 tabnoeud[1]=lstnoeuddirect[mgquad->get_noeud2()->get_nouveau_numero()];
1322 tabnoeud[2]=lstnoeuddirect[mgquad->get_noeud3()->get_nouveau_numero()];
1323 tabnoeud[3]=lstnoeuddirect[mgquad->get_noeud4()->get_nouveau_numero()];
1324 FEM_QUADRANGLE4* quad=new FEM_QUADRANGLE4(mgquad,tabnoeud);
1325 ajouter_fem_element2(quad);
1326 mgquad=maillage->get_suivant_quadrangle(it_quad);
1327 }
1328 }
1329 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==3)))
1330 {
1331 LISTE_MG_TETRA::iterator it_tetra;
1332 MG_TETRA* mgtetra=maillage->get_premier_tetra(it_tetra);
1333 while (mgtetra)
1334 {
1335 FEM_NOEUD *tabnoeud[4];
1336 tabnoeud[0]=lstnoeuddirect[mgtetra->get_noeud1()->get_nouveau_numero()];
1337 tabnoeud[1]=lstnoeuddirect[mgtetra->get_noeud2()->get_nouveau_numero()];
1338 tabnoeud[2]=lstnoeuddirect[mgtetra->get_noeud3()->get_nouveau_numero()];
1339 tabnoeud[3]=lstnoeuddirect[mgtetra->get_noeud4()->get_nouveau_numero()];
1340 FEM_TETRA4* tet=new FEM_TETRA4(mgtetra,tabnoeud);
1341 ajouter_fem_element3(tet);
1342 mgtetra=maillage->get_suivant_tetra(it_tetra);
1343 }
1344 LISTE_MG_HEXA::iterator it_hex;
1345 MG_HEXA* mghex=maillage->get_premier_hexa(it_hex);
1346 while (mghex)
1347 {
1348 FEM_NOEUD *tabnoeud[8];
1349 tabnoeud[0]=lstnoeuddirect[mghex->get_noeud1()->get_nouveau_numero()];
1350 tabnoeud[1]=lstnoeuddirect[mghex->get_noeud2()->get_nouveau_numero()];
1351 tabnoeud[2]=lstnoeuddirect[mghex->get_noeud3()->get_nouveau_numero()];
1352 tabnoeud[3]=lstnoeuddirect[mghex->get_noeud4()->get_nouveau_numero()];
1353 tabnoeud[4]=lstnoeuddirect[mghex->get_noeud5()->get_nouveau_numero()];
1354 tabnoeud[5]=lstnoeuddirect[mghex->get_noeud6()->get_nouveau_numero()];
1355 tabnoeud[6]=lstnoeuddirect[mghex->get_noeud7()->get_nouveau_numero()];
1356 tabnoeud[7]=lstnoeuddirect[mghex->get_noeud8()->get_nouveau_numero()];
1357 FEM_HEXA8* hex=new FEM_HEXA8(mghex,tabnoeud);
1358 ajouter_fem_element3(hex);
1359 mghex=maillage->get_suivant_hexa(it_hex);
1360 }
1361 }
1362 }
1363
1364
1365 void FEM_MAILLAGE::construire_quadratique(void)
1366 {
1367 LISTE_MG_NOEUD::iterator it_nd;
1368 MG_NOEUD* mgnoeud=maillage->get_premier_noeud(it_nd);
1369 std::vector<FEM_NOEUD*> lstnoeuddirect;
1370 unsigned int i=0;
1371 while (mgnoeud)
1372 {
1373 mgnoeud->change_nouveau_numero(i);
1374 FEM_NOEUD* femnoeud=new FEM_NOEUD(mgnoeud);
1375 femnoeud->change_numero(i+1);
1376 i++ ;
1377 ajouter_fem_noeud(femnoeud);
1378 //mgnoeud=maillage->get_suivant_noeud(it_nd);
1379 lstnoeuddirect.insert(lstnoeuddirect.end(),femnoeud);
1380 if (mgnoeud->get_lien_topologie()!=NULL)
1381 if (mgnoeud->get_lien_topologie()->get_dimension()==0)
1382 {
1383 FEM_ELEMENT0* femele=new FEM_ELEMENT0(mgnoeud->get_lien_topologie(),mgnoeud,&femnoeud);
1384 ajouter_fem_element0(femele);
1385 }
1386 mgnoeud=maillage->get_suivant_noeud(it_nd);
1387
1388 }
1389 int dimsansgeo=0;
1390 if (get_mg_geometrie()==NULL)
1391 {
1392 if (maillage->get_nb_mg_tetra()!=0) dimsansgeo=3;
1393 else if (maillage->get_nb_mg_triangle()!=0) dimsansgeo=2;
1394 else if (maillage->get_nb_mg_segment()!=0) dimsansgeo=1;
1395 }
1396 if (get_mg_geometrie()!=NULL)
1397 if (strcmp(get_mg_geometrie()->get_type_geometrie(),"VIRTUEL")==0)
1398 {
1399 if (maillage->get_nb_mg_tetra()+maillage->get_nb_mg_hexa()!=0) dimsansgeo=3;
1400 else if (maillage->get_nb_mg_triangle()+maillage->get_nb_mg_quadrangle()!=0) dimsansgeo=2;
1401 else if (maillage->get_nb_mg_segment()!=0) dimsansgeo=1;
1402 }
1403 int nbmgnoeud = maillage->get_nb_mg_noeud();
1404
1405 LISTE_MG_SEGMENT::iterator it_seg;
1406 MG_SEGMENT* mgseg=maillage->get_premier_segment(it_seg);
1407 FEM_MAILLAGE_QUADRATIQUE_OUTILS ou ;
1408 i=0;
1409 while (mgseg)
1410 {
1411 mgseg->change_nouveau_numero(i++);
1412 MG_NOEUD *noeud1=mgseg->get_noeud1();
1413 MG_NOEUD *noeud2=mgseg->get_noeud2();
1414 double *xyz1=noeud1->get_coord();
1415 double *xyz2=noeud2->get_coord();
1416 FEM_NOEUD* femnoeud;
1417 if (mgseg->get_lien_topologie()!=NULL)
1418 if (mgseg->get_lien_topologie()->get_dimension()==1)
1419 {
1420 MG_ARETE* arete=(MG_ARETE*)(mgseg->get_lien_topologie());
1421 double t1,t2,tm;
1422 arete->inverser(t1,xyz1);
1423 arete->inverser(t2,xyz2);
1424 if (arete->get_courbe()->est_periodique())
1425 if (t1>t2) t2=t2+arete->get_courbe()->get_periode();
1426 double t=0.5*(t1+t2);
1427 double xyz[2],xyz3[2];
1428 arete->evaluer(t,xyz);
1429 double L3=0,L4=0,j=0.0;
1430 double L1= ou.get_distance_curviligne(0,0.5,xyz1,xyz,xyz2);
1431 double L2= ou.get_distance_curviligne(0.5,1,xyz1,xyz,xyz2);
1432
1433 if (L1/L2 >1.01)
1434 {
1435 do
1436 {
1437 j+=0.0001;
1438 tm=(-t+t1)*j+t;
1439 arete->evaluer(tm,xyz3);
1440 L3= ou.get_distance_curviligne(0,0.5,xyz1,xyz3,xyz2);
1441 L4= ou.get_distance_curviligne(0.5,1,xyz1,xyz3,xyz2);
1442
1443 }while (0.5-(L4/(L3+L4))>=0.0001);
1444
1445 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),xyz3[0],xyz3[1],xyz3[2]);
1446 }
1447
1448 if (L2/L1 >1.01)
1449 {
1450 do
1451 {
1452 j+=0.0001;
1453 tm=(-t+t2)*j+t;
1454 arete->evaluer(tm,xyz3);
1455 L3= ou.get_distance_curviligne(0,0.5,xyz1,xyz3,xyz2);
1456 L4= ou.get_distance_curviligne(0.5,1,xyz1,xyz3,xyz2);
1457
1458 }while (0.5-(L3/(L3+L4))>=0.0001);
1459
1460 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),xyz3[0],xyz3[1],xyz3[2]);
1461 }
1462
1463 if(j == 0)
1464 {
1465 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),xyz[0],xyz[1],xyz[2]);
1466 }
1467
1468 }
1469 if (mgseg->get_lien_topologie()!=NULL)
1470 if (mgseg->get_lien_topologie()->get_dimension()==2)
1471 {
1472 MG_FACE* face=(MG_FACE*)(mgseg->get_lien_topologie());
1473 double uv1[2],uv2[2];
1474 OT_DECALAGE_PARAMETRE decalage(face->get_surface()->get_periode_u(),face->get_surface()->get_periode_v());
1475 face->inverser(uv1,xyz1);
1476 face->inverser(uv2,xyz2);
1477 if (face->get_surface()->est_periodique_u()==1)
1478 {
1479 double eps=1e-10*face->get_surface()->get_periode_u();
1480 if (uv1[0]<-eps) uv1[0]=uv1[0]+face->get_surface()->get_periode_u();
1481 if (uv1[0]>face->get_surface()->get_periode_u()-eps) uv1[0]=uv1[0]-face->get_surface()->get_periode_u();
1482 if (uv2[0]<-eps) uv2[0]=uv2[0]+face->get_surface()->get_periode_u();
1483 if (uv2[0]>face->get_surface()->get_periode_u()-eps) uv2[0]=uv2[0]-face->get_surface()->get_periode_u();
1484 }
1485 if (face->get_surface()->est_periodique_v()==1)
1486 {
1487 double eps=1e-10*face->get_surface()->get_periode_v();
1488 if (uv1[1]<-eps) uv1[1]=uv1[1]+face->get_surface()->get_periode_v();
1489 if (uv1[1]>face->get_surface()->get_periode_v()-eps) uv1[1]=uv1[1]-face->get_surface()->get_periode_v();
1490 if (uv2[1]<-eps) uv2[1]=uv2[1]+face->get_surface()->get_periode_v();
1491 if (uv2[1]>face->get_surface()->get_periode_v()-eps) uv2[1]=uv2[1]-face->get_surface()->get_periode_v();
1492 }
1493 double du=decalage.calcul_decalage_parametre_u(uv1[0]);
1494 double dv=decalage.calcul_decalage_parametre_v(uv1[1]);
1495 double u1=decalage.decalage_parametre_u(uv1[0],du);
1496 double v1=decalage.decalage_parametre_v(uv1[1],dv);
1497 double u2=decalage.decalage_parametre_u(uv2[0],du);
1498 double v2=decalage.decalage_parametre_v(uv2[1],dv);
1499 double uv[2],uv3[2],xyz[3],xyz3[3];
1500 double milieu[3];
1501 milieu[0]=0.5*(xyz1[0]+xyz2[0]);
1502 milieu[1]=0.5*(xyz1[1]+xyz2[1]);
1503 milieu[2]=0.5*(xyz1[2]+xyz2[2]);
1504 face->inverser(uv,milieu);
1505
1506 face->evaluer(uv,xyz);
1507 double L3=0,L4=0,j=0;
1508 double L1= ou.get_distance_curviligne(0,0.5,xyz1,xyz,xyz2);
1509 double L2= ou.get_distance_curviligne(0.5,1,xyz1,xyz,xyz2);
1510 if (L1/L2 >1.01)
1511 {
1512 do
1513 {
1514 j+=0.0001;
1515 if ((uv1[0]<uv[0]) && (uv2[0]<uv[0]) && (uv1[0]<uv2[0])) uv1[0]=uv1[0]+face->get_surface()->get_periode_u();
1516 if ((uv1[1]<uv[1]) && (uv2[1]<uv[1]) && (uv1[1]<uv2[1])) uv1[1]=uv1[1]+face->get_surface()->get_periode_v();
1517
1518 uv3[0]=(-uv[0]+uv1[0])*j+uv[0];
1519 uv3[1]=(-uv[1]+uv1[1])*j+uv[1];
1520
1521 face->evaluer(uv3,xyz3);
1522 L3= ou.get_distance_curviligne(0,0.5,xyz1,xyz3,xyz2);
1523 L4= ou.get_distance_curviligne(0.5,1,xyz1,xyz3,xyz2);
1524
1525 }while ( 0.5-(L4/(L3+L4)) >=0.0001);
1526
1527 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),xyz3[0],xyz3[1],xyz3[2]);
1528 }
1529
1530 if (L2/L1 >1.01)
1531 {
1532 do
1533 {
1534 j+=0.0001;
1535 if ((uv1[0]<uv[0]) && (uv2[0]<uv[0]) && (uv2[0]<uv1[0])) uv2[0]=uv2[0]+face->get_surface()->get_periode_u();
1536 if ((uv1[1]<uv[1]) && (uv2[1]<uv[1]) && (uv2[1]<uv1[1])) uv2[1]=uv2[1]+face->get_surface()->get_periode_v();
1537
1538 uv3[0]=(-uv[0]+uv2[0])*j+uv[0];
1539 uv3[1]=(-uv[1]+uv2[1])*j+uv[1];
1540
1541 face->evaluer(uv3,xyz3);
1542 L3= ou.get_distance_curviligne(0,0.5,xyz1,xyz3,xyz2);
1543 L4= ou.get_distance_curviligne(0.5,1,xyz1,xyz3,xyz2);
1544
1545 }while (0.5-(L3/(L3+L4)) >=0.0001);
1546
1547 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),xyz3[0],xyz3[1],xyz3[2]);
1548 }
1549
1550 if (j == 0.0)
1551 {
1552 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),xyz[0],xyz[1],xyz[2]);
1553 }
1554
1555 }
1556 if (mgseg->get_lien_topologie()!=NULL)
1557 {
1558 if (mgseg->get_lien_topologie()->get_dimension()==3)
1559 {
1560 double x=0.5*(xyz1[0]+xyz2[0]);
1561 double y=0.5*(xyz1[1]+xyz2[1]);
1562 double z=0.5*(xyz1[2]+xyz2[2]);
1563 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),x,y,z);
1564 }
1565 }
1566 else
1567 {
1568 double x=0.5*(xyz1[0]+xyz2[0]);
1569 double y=0.5*(xyz1[1]+xyz2[1]);
1570 double z=0.5*(xyz1[2]+xyz2[2]);
1571 femnoeud= new FEM_NOEUD(mgseg->get_lien_topologie(),x,y,z);
1572 }
1573 femnoeud->change_numero(i+nbmgnoeud+1);
1574 ajouter_fem_noeud(femnoeud);
1575 mgseg=maillage->get_suivant_segment(it_seg);
1576 lstnoeuddirect.insert(lstnoeuddirect.end(),femnoeud);
1577 }
1578
1579 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==1)))
1580 {
1581
1582 mgseg=maillage->get_premier_segment(it_seg);
1583 while (mgseg)
1584 {
1585 if (mgseg->get_lien_topologie()!=NULL)
1586 if (mgseg->get_lien_topologie()->get_dimension()!=1)
1587 {
1588 mgseg=maillage->get_suivant_segment(it_seg);
1589 continue;
1590 }
1591 if (get_mg_geometrie()!=NULL)
1592 if (mgseg->get_lien_topologie()==NULL)
1593 if (dimsansgeo!=1)
1594 {
1595 mgseg=maillage->get_suivant_segment(it_seg);
1596 continue;
1597 }
1598 FEM_NOEUD *tabnoeud[3];
1599 tabnoeud[0]=lstnoeuddirect[mgseg->get_noeud1()->get_nouveau_numero()];
1600 tabnoeud[1]=lstnoeuddirect[mgseg->get_nouveau_numero()+nbmgnoeud];
1601 tabnoeud[2]=lstnoeuddirect[mgseg->get_noeud2()->get_nouveau_numero()];
1602 FEM_SEGMENT3* seg=new FEM_SEGMENT3(mgseg,tabnoeud);
1603 ajouter_fem_element1(seg);
1604 mgseg=maillage->get_suivant_segment(it_seg);
1605 }
1606 }
1607 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==2)))
1608 {
1609 LISTE_MG_TRIANGLE::iterator it_tri;
1610 MG_TRIANGLE* mgtri=maillage->get_premier_triangle(it_tri);
1611 while (mgtri)
1612 {
1613 if (mgtri->get_lien_topologie()!=NULL) if (mgtri->get_lien_topologie()->get_dimension()!=2)
1614 {
1615 mgtri=maillage->get_suivant_triangle(it_tri);
1616 continue;
1617 }
1618 if (get_mg_geometrie()!=NULL)
1619 if (mgtri->get_lien_topologie()==NULL)
1620 if (dimsansgeo!=2)
1621 {
1622 mgtri=maillage->get_suivant_triangle(it_tri);
1623 continue;
1624 }
1625 FEM_NOEUD *tabnoeud[6];
1626 tabnoeud[0]=lstnoeuddirect[mgtri->get_noeud1()->get_nouveau_numero()];
1627 tabnoeud[1]=lstnoeuddirect[mgtri->get_segment1()->get_nouveau_numero()+nbmgnoeud];
1628 tabnoeud[2]=lstnoeuddirect[mgtri->get_noeud2()->get_nouveau_numero()];
1629 tabnoeud[3]=lstnoeuddirect[mgtri->get_segment2()->get_nouveau_numero()+nbmgnoeud];
1630 tabnoeud[4]=lstnoeuddirect[mgtri->get_noeud3()->get_nouveau_numero()];
1631 tabnoeud[5]=lstnoeuddirect[mgtri->get_segment3()->get_nouveau_numero()+nbmgnoeud];
1632 FEM_TRIANGLE6* tri=new FEM_TRIANGLE6(mgtri,tabnoeud);
1633 ajouter_fem_element2(tri);
1634 mgtri=maillage->get_suivant_triangle(it_tri);
1635 }
1636 LISTE_MG_QUADRANGLE::iterator it_quad;
1637 MG_QUADRANGLE* mgquad=maillage->get_premier_quadrangle(it_quad);
1638 while (mgquad)
1639 {
1640 if (mgquad->get_lien_topologie()!=NULL) if (mgquad->get_lien_topologie()->get_dimension()!=2) {
1641 mgquad=maillage->get_suivant_quadrangle(it_quad);
1642 continue;
1643 }
1644 if (get_mg_geometrie()!=NULL)
1645 if (mgquad->get_lien_topologie()==NULL)
1646 if (dimsansgeo!=2)
1647 {
1648 mgquad=maillage->get_suivant_quadrangle(it_quad);
1649 continue;
1650 }
1651 FEM_NOEUD *tabnoeud[8];
1652 tabnoeud[0]=lstnoeuddirect[mgquad->get_noeud1()->get_nouveau_numero()];
1653 tabnoeud[1]=lstnoeuddirect[mgquad->get_segment1()->get_nouveau_numero()+nbmgnoeud];
1654 tabnoeud[2]=lstnoeuddirect[mgquad->get_noeud2()->get_nouveau_numero()];
1655 tabnoeud[3]=lstnoeuddirect[mgquad->get_segment2()->get_nouveau_numero()+nbmgnoeud];
1656 tabnoeud[4]=lstnoeuddirect[mgquad->get_noeud3()->get_nouveau_numero()];
1657 tabnoeud[5]=lstnoeuddirect[mgquad->get_segment3()->get_nouveau_numero()+nbmgnoeud];
1658 tabnoeud[6]=lstnoeuddirect[mgquad->get_noeud4()->get_nouveau_numero()];
1659 tabnoeud[7]=lstnoeuddirect[mgquad->get_segment4()->get_nouveau_numero()+nbmgnoeud];
1660 FEM_QUADRANGLE8* quad=new FEM_QUADRANGLE8(mgquad,tabnoeud);
1661 ajouter_fem_element2(quad);
1662 mgquad=maillage->get_suivant_quadrangle(it_quad);
1663 }
1664 }
1665 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==3)))
1666 {
1667
1668 LISTE_MG_TETRA::iterator it_tetra;
1669 MG_TETRA* mgtetra=maillage->get_premier_tetra(it_tetra);
1670 while (mgtetra)
1671 {
1672 FEM_NOEUD *tabnoeud[10];
1673 tabnoeud[0]=lstnoeuddirect[mgtetra->get_noeud1()->get_nouveau_numero()];
1674 tabnoeud[1]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud1()->get_id(),mgtetra->get_noeud2()->get_id())->get_nouveau_numero()+nbmgnoeud];
1675 tabnoeud[2]=lstnoeuddirect[mgtetra->get_noeud2()->get_nouveau_numero()];
1676 tabnoeud[3]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud2()->get_id(),mgtetra->get_noeud3()->get_id())->get_nouveau_numero()+nbmgnoeud];
1677 tabnoeud[4]=lstnoeuddirect[mgtetra->get_noeud3()->get_nouveau_numero()];
1678 tabnoeud[5]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud3()->get_id(),mgtetra->get_noeud1()->get_id())->get_nouveau_numero()+nbmgnoeud];
1679 tabnoeud[6]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud1()->get_id(),mgtetra->get_noeud4()->get_id())->get_nouveau_numero()+nbmgnoeud];
1680 tabnoeud[7]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud2()->get_id(),mgtetra->get_noeud4()->get_id())->get_nouveau_numero()+nbmgnoeud];
1681 tabnoeud[8]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud3()->get_id(),mgtetra->get_noeud4()->get_id())->get_nouveau_numero()+nbmgnoeud];
1682 tabnoeud[9]=lstnoeuddirect[mgtetra->get_noeud4()->get_nouveau_numero()];
1683 FEM_TETRA10* tet=new FEM_TETRA10(mgtetra,tabnoeud);
1684 ajouter_fem_element3(tet);
1685 mgtetra=maillage->get_suivant_tetra(it_tetra);
1686 }
1687 LISTE_MG_HEXA::iterator it_hexa;
1688 MG_HEXA* mghex=maillage->get_premier_hexa(it_hexa);
1689 while (mghex)
1690 {
1691 FEM_NOEUD *tabnoeud[20];
1692 tabnoeud[0]=lstnoeuddirect[mghex->get_noeud1()->get_nouveau_numero()];
1693 tabnoeud[1]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud1()->get_id(),mghex->get_noeud2()->get_id())->get_nouveau_numero()+nbmgnoeud];
1694 tabnoeud[2]=lstnoeuddirect[mghex->get_noeud2()->get_nouveau_numero()];
1695 tabnoeud[3]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud2()->get_id(),mghex->get_noeud3()->get_id())->get_nouveau_numero()+nbmgnoeud];
1696 tabnoeud[4]=lstnoeuddirect[mghex->get_noeud3()->get_nouveau_numero()];
1697 tabnoeud[5]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud3()->get_id(),mghex->get_noeud4()->get_id())->get_nouveau_numero()+nbmgnoeud];
1698 tabnoeud[6]=lstnoeuddirect[mghex->get_noeud4()->get_nouveau_numero()];
1699 tabnoeud[7]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud4()->get_id(),mghex->get_noeud1()->get_id())->get_nouveau_numero()+nbmgnoeud];
1700 tabnoeud[8]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud1()->get_id(),mghex->get_noeud5()->get_id())->get_nouveau_numero()+nbmgnoeud];
1701 tabnoeud[9]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud2()->get_id(),mghex->get_noeud6()->get_id())->get_nouveau_numero()+nbmgnoeud];
1702 tabnoeud[10]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud3()->get_id(),mghex->get_noeud7()->get_id())->get_nouveau_numero()+nbmgnoeud];
1703 tabnoeud[11]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud4()->get_id(),mghex->get_noeud8()->get_id())->get_nouveau_numero()+nbmgnoeud];
1704 tabnoeud[12]=lstnoeuddirect[mghex->get_noeud5()->get_nouveau_numero()];
1705 tabnoeud[13]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud5()->get_id(),mghex->get_noeud6()->get_id())->get_nouveau_numero()+nbmgnoeud];
1706 tabnoeud[14]=lstnoeuddirect[mghex->get_noeud6()->get_nouveau_numero()];
1707 tabnoeud[15]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud6()->get_id(),mghex->get_noeud7()->get_id())->get_nouveau_numero()+nbmgnoeud];
1708 tabnoeud[16]=lstnoeuddirect[mghex->get_noeud7()->get_nouveau_numero()];
1709 tabnoeud[17]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud7()->get_id(),mghex->get_noeud8()->get_id())->get_nouveau_numero()+nbmgnoeud];
1710 tabnoeud[18]=lstnoeuddirect[mghex->get_noeud8()->get_nouveau_numero()];
1711 tabnoeud[19]=lstnoeuddirect[maillage->get_mg_segment(mghex->get_noeud8()->get_id(),mghex->get_noeud5()->get_id())->get_nouveau_numero()+nbmgnoeud];
1712 FEM_HEXA20* hex=new FEM_HEXA20(mghex,tabnoeud);
1713 ajouter_fem_element3(hex);
1714 mghex=maillage->get_suivant_hexa(it_hexa);
1715 }
1716 }
1717 }
1718
1719
1720
1721 void FEM_MAILLAGE::enregistrer(std::ostream& o,double version)
1722 {
1723
1724 if (est_structure==true)
1725 {
1726 if (mg_geometrie==NULL) o << "%" << get_id() << "=FEM_MAILLAGE_STRUCTURE(" << degre << ",$" << maillage->get_id()<< ",NULL," << boite_englobante.get_xmin() << "," << boite_englobante.get_ymin() << "," << boite_englobante.get_zmin() << "," << boite_englobante.get_xmax() << "," << boite_englobante.get_ymax() << ","<< boite_englobante.get_zmax() << "," << nx <<"," << ny << "," << nz << ");" << std::endl;
1727 else o << "%" << get_id() << "=FEM_MAILLAGE_STRUCTURE("<< degre << ",$" << maillage->get_id() << ",$" << mg_geometrie->get_id() <<"," << boite_englobante.get_xmin() << "," << boite_englobante.get_ymin() << "," << boite_englobante.get_zmin() << "," << boite_englobante.get_xmax() << "," << boite_englobante.get_ymax() << ","<< boite_englobante.get_zmax() << "," << nx <<"," << ny << "," << nz <<");" << std::endl;
1728
1729 }
1730 else
1731 {
1732 if (mg_geometrie==NULL) o << "%" << get_id() << "=FEM_MAILLAGE(" << degre << ",$" << maillage->get_id() << " );" << std::endl;
1733 else o << "%" << get_id() << "=FEM_MAILLAGE("<< degre << ",$" << maillage->get_id() << ",$" << mg_geometrie->get_id() <<");" << std::endl;
1734 }
1735
1736
1737 LISTE_ENTITE::const_iterator i;
1738 for (i=lst_entite.begin();i!=lst_entite.end();i++)
1739 (*i)->enregistrer(o,version);
1740 }
1741
1742
1743 void FEM_MAILLAGE::exporter_cosmos(std::string& nomfic)
1744 {
1745 char chaine[500];
1746 sprintf(chaine,"%s.ses",nomfic.c_str());
1747 std::ofstream of1(chaine,std::ios::out|std::ios::trunc);
1748 of1.precision(16);
1749 of1.setf(std::ios::showpoint);
1750 of1 << "TITLE, " << chaine << " : Fichier FEM de maillage MAGiC" << std::endl;
1751 if (degre==1) of1 << "EGROUP,1,TETRA4,0,0,0,0,0,0,0,0;" << std::endl;
1752 if (degre==2) of1 << "EGROUP,1,TETRA10,0,0,0,0,0,0,0,0;" << std::endl;
1753 int nb_volume=mg_geometrie->get_nb_mg_volume();
1754 int nbNoeuds = 0;
1755
1756
1757 for (int i=0;i<nb_volume;i++)
1758 {
1759 MG_VOLUME *mgvol=mg_geometrie->get_mg_volume(i);
1760 if (mgvol->get_num_materiau()>=0)
1761 {
1762 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
1763 MC_MATERIAU* mat=mtgest.get_materiau(mgvol->get_num_materiau());
1764 for (int m=0; m<mat->get_nb_propriete();m++)
1765 {
1766 MC_PROPRIETE* prop=mat->get_propriete(m);
1767 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
1768 }
1769 /* MT_PROPRIETE* prop=mat->get_propriete("EX");
1770 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", EX, " << prop->get_valeur(2) << ";" << std::endl;
1771 prop=mat->get_propriete("NUXY");
1772 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", NUXY, " << prop->get_valeur(2) << ";" << std::endl;
1773 prop=mat->get_propriete("GXY");
1774 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", GXY, " << prop->get_valeur(2) << ";" << std::endl;
1775 prop=mat->get_propriete("DENS");
1776 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", DENS, " << prop->get_valeur(2) << ";" << std::endl;
1777 prop=mat->get_propriete("SIGXT");
1778 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", SIGXT, " << prop->get_valeur(2) << ";" << std::endl;
1779 prop=mat->get_propriete("SIGYLD");
1780 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", SIGYLD, " << prop->get_valeur(2) << ";" << std::endl;
1781 prop=mat->get_propriete("ALPX");
1782 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", ALPX, " << prop->get_valeur(2) << ";" << std::endl;
1783 prop=mat->get_propriete("KX");
1784 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", KX, " << prop->get_valeur(2) << ";" << std::endl;
1785 prop=mat->get_propriete("C");
1786 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", C , " << prop->get_valeur(2) << ";" << std::endl;*/
1787 }
1788 }
1789 int nb_coques = mg_geometrie->get_nb_mg_coque();
1790 for (int i=0;i<nb_coques;i++)
1791 {
1792 MG_COQUE *mgcoque=mg_geometrie->get_mg_coque(i);
1793 if (mgcoque->get_num_materiau()>=0)
1794 {
1795 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
1796 MC_MATERIAU* mat=mtgest.get_materiau(mgcoque->get_num_materiau());
1797 for (int m=0; m<mat->get_nb_propriete();m++)
1798 {
1799 MC_PROPRIETE* prop=mat->get_propriete(m);
1800 of1<< "MPROP, "<< mgcoque->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
1801 }
1802 }
1803 }
1804 int nb_poutres = mg_geometrie->get_nb_mg_poutre();
1805 for (int i=0;i<nb_poutres;i++)
1806 {
1807 MG_POUTRE *mgpoutre=mg_geometrie->get_mg_poutre(i);
1808 if (mgpoutre->get_num_materiau()>=0)
1809 {
1810 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
1811 MC_MATERIAU* mat=mtgest.get_materiau(mgpoutre->get_num_materiau());
1812
1813 for (int m=0; m<mat->get_nb_propriete();m++)
1814 {
1815 MC_PROPRIETE* prop=mat->get_propriete(m);
1816 of1<< "MPROP, "<< mgpoutre->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
1817 }
1818 }
1819 }
1820
1821
1822
1823 of1 << "ACTSET,CS,0;" << std::endl;
1824 of1 << "ACTSET,EG,1;" << std::endl;
1825
1826 // �riture des noeuds
1827 int ii=0;
1828 double valeurunite=mg_geometrie->get_valeur_unite();
1829 for (LISTE_FEM_NOEUD::iterator i=lst_fem_noeud.begin();i!=lst_fem_noeud.end();i++)
1830 {
1831 FEM_NOEUD* noeud=((*i).second);
1832 of1 << "ND, " << noeud->get_numero() << ", " << noeud->get_x()*valeurunite << ", " << noeud->get_y()*valeurunite << ", " << noeud->get_z()*valeurunite << ";" << std::endl;
1833 char nom[3];
1834 int nb=noeud->get_lien_topologie()->get_nb_ccf();
1835 for (int k=0;k<nb;k++)
1836 {
1837 noeud->get_lien_topologie()->get_type_ccf(k,nom);
1838 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;
1839 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;
1840 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;
1841 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;
1842 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;
1843 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;
1844 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;
1845 }
1846 ii++;
1847 }
1848 nbNoeuds = ii;
1849 ii=0;
1850
1851 // �criture des t�tra�dres
1852 int nummat=-10; // num�o du mat�iau
1853 for (LISTE_FEM_ELEMENT3::iterator i=lst_fem_element3.begin();i!=lst_fem_element3.end();i++)
1854 {
1855 FEM_ELEMENT3* tetra=((*i).second);
1856 MG_VOLUME* vol=(MG_VOLUME*)tetra->get_lien_topologie();
1857 int nummatac=vol->get_num_materiau();
1858 if ((nummatac!=nummat) && (nummatac!=-1))
1859 {
1860 nummat=nummatac;
1861 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
1862 }
1863 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() << ", " ;
1864 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() << ", " ;
1865 ii++;
1866 MG_TETRA* tet=(MG_TETRA*)tetra->get_mg_element_maillage();
1867 if (tet->get_triangle1()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
1868 else of1 << "0, ";
1869 if (tet->get_triangle2()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
1870 else of1 << "0, ";
1871 if (tet->get_triangle3()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
1872 else of1 << "0, ";
1873 if (tet->get_triangle4()->get_lien_topologie()->get_dimension()!=3) of1 << "1;" << std::endl ;
1874 else of1 << "0;" << std::endl;
1875 char nom[3];
1876 int nb=tet->get_triangle1()->get_lien_topologie()->get_nb_ccf();
1877 for (int k=0;k<nb;k++)
1878 {
1879 tet->get_triangle1()->get_lien_topologie()->get_type_ccf(k,nom);
1880 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 1;" << std::endl;
1881 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 2;" << std::endl;
1882 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 3;" << std::endl;
1883 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 4;" << std::endl;
1884 }
1885 nb=tet->get_triangle2()->get_lien_topologie()->get_nb_ccf();
1886 for (int k=0;k<nb;k++)
1887 {
1888 tet->get_triangle2()->get_lien_topologie()->get_type_ccf(k,nom);
1889 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 1;" << std::endl;
1890 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 2;" << std::endl;
1891 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 3;" << std::endl;
1892 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 4;" << std::endl;
1893 }
1894 nb=tet->get_triangle3()->get_lien_topologie()->get_nb_ccf();
1895 for (int k=0;k<nb;k++)
1896 {
1897 tet->get_triangle3()->get_lien_topologie()->get_type_ccf(k,nom);
1898 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 1;" << std::endl;
1899 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 2;" << std::endl;
1900 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 3;" << std::endl;
1901 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 4;" << std::endl;
1902 }
1903 nb=tet->get_triangle4()->get_lien_topologie()->get_nb_ccf();
1904 for (int k=0;k<nb;k++)
1905 {
1906 tet->get_triangle4()->get_lien_topologie()->get_type_ccf(k,nom);
1907 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 1;" << std::endl;
1908 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 2;" << std::endl;
1909 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 3;" << std::endl;
1910 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 4;" << std::endl;
1911 }
1912 }
1913
1914
1915 //*********************************************************
1916 // Les t�tras sont finis, maintenant le maillage des Coques
1917 //*********************************************************
1918 //nb_coques=mg_geometrie->get_nb_mg_coque(); //variable d��d�lar� plus haut, elle devrait avoir conserv�sa valeur
1919 if (nb_coques>0)
1920 {
1921 if (degre==1) of1 << "EGROUP,2,SHELL3,0,0,0,0,0,0,0,0;" << std::endl; // Formulation coques minces... SHELL3T pout �aisses
1922 if (degre==2) of1 << "EGROUP,2,SHELL6,0,0,0,0,0,0,0,0;" << std::endl;
1923 }
1924
1925 if (nb_poutres>0 || nb_coques>0 )
1926 {
1927 of1 << "EGROUP,3,BEAM3D,0,0,0,0,0,0,0,0;"<< std::endl; //Egroup des mini-poutres
1928 of1 << "RCONST,3,3,1,3," << "1, 1 , 1; " << std::endl;
1929 of1 << "EGROUP,4,RBAR;"<< std::endl; // EGroup des RBAR
1930 of1 << "EGROUP,5,BEAM3D,0,0,0,0,0,0,0,0;"<< std::endl; //Egroup des mini-poutres infiniment rigide
1931 of1 << "RCONST,5,5,1,3," << "0.01, 0.01 , 0.01; " << std::endl;
1932 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...)
1933 of1 << "RCONST,6,6,1,3," << "1e-16, 0.01 , 1e-16; " << std::endl;
1934 }
1935
1936 int RCset =7;
1937
1938 LISTE_MG_COQUE::iterator ico;
1939 MG_COQUE *mgcoque=mg_geometrie->get_premier_coque(ico);
1940 while (mgcoque)
1941 {
1942 int nummatac=mgcoque->get_num_materiau();
1943 if ((nummatac!=nummat)&&(nummatac!=-1)) // si c'est = 0 alors on place le dernier mat�iau choisi.
1944 {
1945 nummat=nummatac;
1946 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
1947 }
1948
1949 for (int numcoquille=0;numcoquille<mgcoque->get_nb_mg_coquille();numcoquille++)
1950 {
1951 MG_COQUILLE* mgcoquille = mgcoque->get_mg_coquille(numcoquille);
1952 for (int cf = 0; cf<mgcoquille->get_nb_mg_coface();cf++)
1953 {
1954 MG_COFACE* mgcoface = mgcoquille->get_mg_coface(cf);
1955 MG_FACE* mgface = mgcoface->get_face();
1956
1957 double epaisseur=-1;
1958 for (int k=0;k<mgface->get_nb_ccf();k++) // aller chercher l'�aisseur de la coque
1959 {
1960 char nomCCF[3];
1961 mgface->get_type_ccf(k,nomCCF);
1962 if (strcmp(nomCCF,"EP")==0)
1963 epaisseur = mgface-> get_valeur_ccf(k);
1964 }
1965 of1 << "ACTSET,EG,2;"<< std::endl;
1966 of1 << "RCONST,2,"<< ++RCset << ",1,1," << epaisseur << ";" << std::endl; // le real constant, s'active automatiquement
1967
1968 TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> * lien_maillage = mgface->get_lien_fem_maillage();
1969 int nbelem=lien_maillage->get_nb();
1970 for (int i=0;i<nbelem;i++)
1971 {
1972 FEM_ELEMENT2* femtriangle=(FEM_ELEMENT2*)lien_maillage->get(i);
1973 if (!contient(femtriangle)) continue;
1974 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;
1975 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;
1976 // dans les noeuds des sommets sont, 1, 2 et 3. les noeuds sur les segments sont 4 5 et 6
1977
1978 long nbc;
1979 MG_TRIANGLE* mgtri=(MG_TRIANGLE*)femtriangle->get_mg_element_maillage();
1980 char nom[3];
1981
1982 nbc = mgtri->get_segment1()->get_lien_topologie()->get_nb_ccf();
1983 for (int z =0 ; z< nbc; z++) // le premier segment
1984 { // il y a au moins une CCF "EP" qu'il faut ignorer
1985 mgtri->get_segment1()->get_lien_topologie()->get_type_ccf(z,nom); // ->get_triangle3()->get_lien_topologie()->get_type_ccf(k,nom);
1986 if (strcmp(nom,"EP")==0) continue;
1987 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;
1988 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;
1989 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;
1990 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;
1991 }
1992 nbc = mgtri->get_segment2()->get_lien_topologie()->get_nb_ccf();
1993 for (int z =0 ; z< nbc; z++)
1994 {
1995 mgtri->get_segment2()->get_lien_topologie()->get_type_ccf(z,nom);
1996 if (strcmp(nom,"EP")==0) continue;
1997 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;
1998 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;
1999 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;
2000 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;
2001 }
2002 nbc = mgtri->get_segment3()->get_lien_topologie()->get_nb_ccf();
2003 for (int z =0 ; z< nbc; z++)
2004 {
2005 mgtri->get_segment3()->get_lien_topologie()->get_type_ccf(z,nom);
2006 if (strcmp(nom,"EP")==0) continue;
2007 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;
2008 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;
2009 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;
2010 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;
2011 }
2012
2013
2014 nbc = mgtri->get_lien_topologie()->get_nb_ccf(); // et pour la face elle-m�e
2015 for (int z =0 ; z< nbc; z++)
2016 {
2017 mgtri->get_lien_topologie()->get_type_ccf(z,nom);
2018 if (strcmp(nom,"EP")==0) continue;
2019 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;
2020 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;
2021 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;
2022 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;
2023 }
2024
2025 }
2026
2027 } // next face
2028 } // next coquille
2029 mgcoque = mg_geometrie->get_suivant_coque(ico);
2030 }// next coque
2031
2032
2033 // **************************
2034 // maintenant les poutres
2035 // **************************
2036
2037
2038
2039 //for (int i = 0 ; i<nb_poutres;i++)
2040 LISTE_MG_POUTRE::iterator it_po;
2041 MG_POUTRE* mgpoutre = mg_geometrie->get_premier_poutre(it_po);
2042 while (mgpoutre)
2043 {
2044 //MG_POUTRE* mgpoutre = mg_geometrie->get_mg_poutre(i);
2045 int nummatac=mgpoutre->get_num_materiau();
2046 if ((nummatac!=nummat)&&(nummatac!=-1))
2047 {
2048 nummat=nummatac;
2049 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
2050 }
2051
2052 for (int j = 0;j<mgpoutre->get_nb_mg_boucle();j++)
2053 {
2054 MG_BOUCLE* mgboucle = mgpoutre->get_mg_boucle(j);
2055
2056 for (int k = 0 ; k<mgboucle->get_nb_mg_coarete();k++)
2057 {
2058 MG_COARETE* mgcoarete = mgboucle->get_mg_coarete(k);
2059 MG_ARETE* mgarete = mgcoarete->get_arete();
2060
2061 double IXX = 0;
2062 double IYY = 0;
2063 double Aire = 0;
2064 double x3 = 0;
2065 double y3 = 0;
2066 double z3 = 0;
2067
2068 for (int k=0;k<mgarete->get_nb_ccf();k++)
2069 {
2070 char nomCCF[3];
2071 mgarete->get_type_ccf(k,nomCCF);
2072 if (strcmp(nomCCF,"As")==0)
2073 Aire = mgarete->get_valeur_ccf(k);
2074 if (strcmp(nomCCF,"IX")==0)
2075 IXX = mgarete->get_valeur_ccf(k);
2076 if (strcmp(nomCCF,"IY")==0)
2077 IYY = mgarete->get_valeur_ccf(k);
2078 if (strcmp(nomCCF,"NX")==0)
2079 x3 = mgarete->get_valeur_ccf(k);
2080 if (strcmp(nomCCF, "NY")==0)
2081 y3 = mgarete->get_valeur_ccf(k);
2082 if (strcmp(nomCCF, "NZ")==0)
2083 z3 = mgarete->get_valeur_ccf(k);
2084 }
2085
2086 if ( Aire==-7) // -7 est un flag pour diff�rencier les mini-poutres...
2087 { // mini-poutre
2088 of1 << "Actset,EG,5;"<<std::endl;
2089 of1 << "Actset,RC,5;"<<std::endl;
2090 of1 << "C* MINI - POUTRE" << std:: endl;
2091
2092 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
2093 {
2094 FEM_ELEMENT1* femseg = (FEM_ELEMENT1*)mgarete->get_lien_fem_maillage()->get(t);
2095 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<femseg->get_fem_noeud(0)->get_numero()<< ","<< femseg->get_fem_noeud(1)->get_numero()<<";" << std::endl;
2096 } // next segment
2097 }
2098 else
2099 { // poutre normale
2100 of1 << "Actset,EG,3;"<<std::endl;
2101 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
2102 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
2103
2104 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
2105 {
2106 FEM_ELEMENT1* femseg = (FEM_ELEMENT1*)mgarete->get_lien_fem_maillage()->get(t);
2107 if (!contient(femseg)) continue;
2108 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;
2109
2110 for (int k=0;k<mgarete->get_nb_ccf();k++)
2111 {
2112 char nom[3];
2113 mgarete->get_type_ccf(k,nom);
2114 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;
2115 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;
2116 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;
2117 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!!!
2118 }
2119 } // next segment
2120 }
2121
2122
2123 } // next arete
2124 } // next boucle
2125 mgpoutre=mg_geometrie->get_suivant_poutre(it_po);
2126 } // next poutre
2127
2128 // Cas sp�cial, une ar�te normale est flagg�e comme une mini-poutre (dans coupecot�)
2129 LISTE_MG_ARETE::iterator ita;
2130 MG_ARETE* mgarete = mg_geometrie->get_premier_arete(ita);
2131
2132 while (mgarete)
2133 {
2134 double Aire = 0;
2135
2136 for (int k=0;k<mgarete->get_nb_ccf();k++)
2137 {
2138 char nomCCF[3];
2139 mgarete->get_type_ccf(k,nomCCF);
2140 if (strcmp(nomCCF,"As")==0)
2141 Aire = mgarete->get_valeur_ccf(k);
2142 }
2143
2144 if ( Aire==-7) // -7 est un flag pour diff�rencier les mini-poutres... non orient�e
2145 { // mini-poutre
2146 of1 << "Actset,EG,5;"<<std::endl;
2147 of1 << "Actset,RC,5;"<<std::endl;
2148 of1 << "C* MINI - POUTRE" << std:: endl;
2149
2150 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
2151 {
2152 FEM_ELEMENT1* femseg = (FEM_ELEMENT1*)mgarete->get_lien_fem_maillage()->get(t);
2153 if (!contient(femseg)) continue;
2154 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<femseg->get_fem_noeud(0)->get_numero()<< ","<< femseg->get_fem_noeud(1)->get_numero()<<";" << std::endl;
2155 }
2156 }
2157 mgarete=mg_geometrie->get_suivant_arete(ita);
2158 }
2159
2160
2161
2162 //************************************************************
2163 // Pour mettre des mini-poutres sur les faces concern�es *****
2164 //*************************************************************
2165 // identifications des faces du qui sont des faces internes.
2166
2167 LISTE_MG_FACE::iterator itf;
2168 MG_FACE* mgface = mg_geometrie->get_premier_face(itf);
2169
2170
2171 while (mgface)
2172 {
2173 for (int k=0;k<mgface->get_nb_ccf();k++)
2174 {
2175 char nomCCF[3];
2176 mgface->get_type_ccf(k,nomCCF);
2177
2178 if (strcmp(nomCCF,"FI")==0)
2179 {
2180 TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> * lien_fem_maillage = mgface->get_lien_fem_maillage();
2181 FEM_ELEMENT_MAILLAGE* element;
2182
2183 //si on a une faceinterne de poutre alors on a une CCF "Po" = 0
2184 // sinon la CCF Po est �gale � 1 et on a une coque
2185 int Poutre = -1;
2186
2187 for (int z=0;z<mgface->get_nb_ccf();z++)
2188 {
2189 char nomCCF2[3];
2190 mgface->get_type_ccf(z,nomCCF);
2191 if (strcmp(nomCCF,"Po")==0)
2192 {
2193 Poutre = mgface->get_valeur_ccf(z);
2194 }
2195 }
2196
2197
2198 if (Poutre ==0)
2199 { // mini-poutres pour des poutres
2200 of1 << "ACTSET,EG,5; C* Face avec mini-poutres de POUTRE"<<std::endl;
2201 of1 << "ACTSET,RC,5;"<<std::endl;
2202 for (int i = 0 ; i< lien_fem_maillage->get_nb();i++)
2203 {
2204 FEM_ELEMENT2* femtriangle=(FEM_ELEMENT2*)lien_fem_maillage->get(i) ;
2205
2206 FEM_NOEUD* nd0 =femtriangle->get_fem_noeud(0);
2207 FEM_NOEUD* nd1 =femtriangle->get_fem_noeud(1);
2208 FEM_NOEUD* nd2= femtriangle->get_fem_noeud(2);
2209
2210 // 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 ;
2211 //si on veut orienter les propri�t�s,
2212 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd0->get_numero()<< "," << nd1->get_numero()<< ";" << std::endl;
2213 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd1->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
2214 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd0->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
2215 }
2216 }
2217 else if (Poutre==1)
2218 { // mini-poutres pour des coques
2219 of1 << "ACTSET,EG,6; C* Face avec mini-poutres de COQUE"<<std::endl;
2220 of1 << "ACTSET,RC,6;"<<std::endl;
2221 for (int i = 0 ; i< lien_fem_maillage->get_nb();i++)
2222 {
2223 FEM_ELEMENT2* femtriangle=(FEM_ELEMENT2*)lien_fem_maillage->get(i) ;
2224
2225 FEM_NOEUD* nd0 =femtriangle->get_fem_noeud(0);
2226 FEM_NOEUD* nd1 =femtriangle->get_fem_noeud(1);
2227 FEM_NOEUD* nd2= femtriangle->get_fem_noeud(2);
2228
2229 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd0->get_numero()<< "," << nd1->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
2230 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd1->get_numero()<< "," << nd2->get_numero()<< "," << nd0->get_numero()<< ";" << std::endl;
2231 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd0->get_numero()<< "," << nd2->get_numero()<< "," << nd1->get_numero()<< ";" << std::endl;
2232 }
2233 }
2234 } // end if FI
2235 } // next CCF
2236 mgface= mg_geometrie->get_suivant_face(itf);
2237 } // end while face
2238
2239
2240
2241 //of1<< "NMERGE;" <<std::endl;
2242 //of1<< "NCOMPRESS;" <<std::endl;
2243
2244 //of1<< "SETEPLOT,1,1,0,0;"<<std::endl;
2245 //of1<< "ACTECLR,1,RC,1;"<<std::endl;
2246
2247 of1<< "EPLOT;"<<std::endl;
2248 of1<< "PSCALE;"<<std::endl;
2249 //lst_FaceInternes.vide();
2250
2251 }
2252
2253
2254 double FEM_MAILLAGE::calcul_coef(void)
2255 {
2256 if (!deforme) return 0.;
2257 LISTE_FEM_NOEUD::iterator it;
2258 double max=0.,dmax=0.;
2259 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
2260 {
2261 double x=noeud->get_x();
2262 double y=noeud->get_y();
2263 double z=noeud->get_z();
2264 double dx=noeud->get_dx();
2265 double dy=noeud->get_dy();
2266 double dz=noeud->get_dz();
2267 if (fabs(x)>max) max=fabs(x);
2268 if (fabs(y)>max) max=fabs(y);
2269 if (fabs(z)>max) max=fabs(z);
2270 if (fabs(dx)>dmax) dmax=fabs(dx);
2271 if (fabs(dy)>dmax) dmax=fabs(dy);
2272 if (fabs(dz)>dmax) dmax=fabs(dz);
2273 }
2274 if (dmax<1e-10) return 0;
2275 double coef=0.1*max/dmax;
2276 return coef;
2277 }
2278
2279
2280
2281
2282 void FEM_MAILLAGE::calcul_deforme(FEM_SOLUTION* solx,int numx,FEM_SOLUTION* soly,int numy,FEM_SOLUTION* solz,int numz)
2283 {
2284 LISTE_FEM_NOEUD::iterator it;
2285 solx->active_solution(numx);
2286 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
2287
2288 noeud->change_dx(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
2289
2290 soly->active_solution(numy);
2291 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
2292
2293 noeud->change_dy(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
2294
2295 solz->active_solution(numz);
2296 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
2297
2298 noeud->change_dz(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
2299
2300 deforme=1;
2301 }
2302
2303
2304 int FEM_MAILLAGE::existe_deforme(void)
2305 {
2306 return deforme;
2307 }
2308
2309 void FEM_MAILLAGE::active_deforme(void)
2310 {
2311 deforme=1;
2312 }
2313
2314 void FEM_MAILLAGE::desactive_deforme(void)
2315 {
2316 deforme=0;
2317 }
2318
2319 int FEM_MAILLAGE::existe_reaction(void)
2320 {
2321 return reaction;
2322 }
2323
2324 void FEM_MAILLAGE::active_reaction(void)
2325 {
2326 reaction=1;
2327 }
2328
2329 void FEM_MAILLAGE::desactive_reaction(void)
2330 {
2331 reaction=0;
2332 }
2333
2334 void FEM_MAILLAGE::calcul_somme_reaction(double &rx,double &ry,double &rz)
2335 {
2336 rx=0.;
2337 ry=0.;
2338 rz=0.;
2339 LISTE_FEM_NOEUD::iterator it;
2340 for (FEM_NOEUD* no=get_premier_noeud(it);no!=NULL;no=get_suivant_noeud(it))
2341 {
2342 rx=rx+no->get_rx();
2343 ry=ry+no->get_ry();
2344 rz=rz+no->get_rz();
2345 }
2346 }
2347
2348
2349
2350
2351
2352
2353
2354 void FEM_MAILLAGE::optimise_numerotation(void)
2355 {
2356 FEM_NOEUD* noeud=get_fem_noeud(0);
2357 FEM_GRAPH_NOEUD *graph;
2358 graph=new FEM_GRAPH_NOEUD(noeud,this);
2359 int e=graph->get_excentricite();
2360 TPL_MAP_ENTITE<FEM_NOEUD*> dernierniveau=graph->get_dernier_niveau();
2361 int nbdernierniveau=dernierniveau.get_nb();
2362 for (int i=0;i<nbdernierniveau;i++)
2363 {
2364 FEM_GRAPH_NOEUD* graphtmp=new FEM_GRAPH_NOEUD(dernierniveau.get(i),this);
2365 int etmp=graphtmp->get_excentricite();
2366 if (etmp>e)
2367 {
2368 delete graph;
2369 graph=graphtmp;
2370 dernierniveau=graph->get_dernier_niveau();
2371 nbdernierniveau=dernierniveau.get_nb();
2372 i=-1;
2373 e=etmp;
2374 }
2375 else delete graphtmp;
2376 }
2377 int numero=get_nb_fem_noeud();
2378 for (int i=0;i<e+1;i++)
2379 {
2380 TPL_MAP_ENTITE<FEM_NOEUD*> niveau=graph->get_niveau(i);
2381 int nbnoeud=niveau.get_nb();
2382 for (int j=0;j<nbnoeud;j++)
2383 {
2384 FEM_NOEUD* noeud=niveau.get(j);
2385 noeud->change_numero_opt(numero);
2386 numero--;
2387 }
2388 }
2389
2390
2391 delete graph;
2392 }
2393
2394 void FEM_MAILLAGE::copie_numerotation_opt(void)
2395 {
2396 int nbnoeud=get_nb_fem_noeud();
2397 for (int i=0;i<nbnoeud;i++)
2398 {
2399 FEM_NOEUD* noeud=get_fem_noeud(i);
2400 noeud->change_numero(noeud->get_numero_opt());
2401 }
2402
2403 }
2404
2405
2406
2407
2408 std::ostream& operator << (std::ostream& o,FEM_MAILLAGE& maillage)
2409 {
2410 maillage.enregistrer(o,VERSIONFICHIER);
2411 return o;
2412 }
2413
2414
2415 void FEM_MAILLAGE::decompte(int &nb_noeud,int &nb_seg2,int &nb_seg3,int &nb_tri3,int &nb_tri6,int &nb_quad4,int &nb_quad8,int &nb_tet4,int &nb_tet10,int &nb_hex8,int &nb_hex20)
2416 {
2417 nb_noeud=get_nb_fem_noeud();
2418 LISTE_FEM_ELEMENT1::iterator it1;
2419 for (FEM_ELEMENT1* ele=get_premier_element1(it1);ele!=NULL;ele=get_suivant_element1(it1))
2420 {
2421 int nb=ele->get_nb_fem_noeud();
2422 if (nb==2) nb_seg2++;
2423 if (nb==3) nb_seg3++;
2424 }
2425 LISTE_FEM_ELEMENT2::iterator it2;
2426 for (FEM_ELEMENT2* ele=get_premier_element2(it2);ele!=NULL;ele=get_suivant_element2(it2))
2427 {
2428 int nb=ele->get_nb_fem_noeud();
2429 if (nb==3) nb_tri3++;
2430 if (nb==4) nb_quad4++;
2431 if (nb==6) nb_tri6++;
2432 if (nb==8) nb_quad8++;
2433 }
2434 LISTE_FEM_ELEMENT3::iterator it3;
2435 for (FEM_ELEMENT3* ele=get_premier_element3(it3);ele!=NULL;ele=get_suivant_element3(it3))
2436 {
2437 int nb=ele->get_nb_fem_noeud();
2438 if (nb==4) nb_tet4++;
2439 if (nb==8) nb_hex8++;
2440 if (nb==10) nb_tet10++;
2441 if (nb==20) nb_hex20++;
2442 }
2443 }
2444
2445
2446 void FEM_MAILLAGE::change_param_structure(BOITE_3D btmp,int nxtmp,int nytmp,int nztmp)
2447 {
2448 boite_englobante=btmp;
2449 nx=nxtmp;
2450 ny=nytmp;
2451 nz=nztmp;
2452 est_structure=true;
2453 }
2454
2455
2456 bool FEM_MAILLAGE::get_param_structure(BOITE_3D &btmp,int &nxtmp,int &nytmp,int &nztmp)
2457 {
2458 if (est_structure==true)
2459 {
2460 btmp=boite_englobante;
2461 nxtmp=nx;
2462 nytmp=ny;
2463 nztmp=nz;
2464 return true;
2465 }
2466 return false;
2467 }
2468
2469 bool FEM_MAILLAGE::get_est_structure(void)
2470 {
2471 return est_structure;
2472 }
2473 void FEM_MAILLAGE::recherche_connexion_multidimension(TPL_MAP_ENTITE<MG_SEGMENT*> &mini)
2474 {
2475 LISTE_MG_NOEUD::iterator it;
2476 for (MG_NOEUD* no=maillage->get_premier_noeud(it);no!=NULL;no=maillage->get_suivant_noeud(it))
2477 {
2478 if ((no->get_lien_hexa()->get_nb()>0) || (no->get_lien_tetra()->get_nb()))
2479 if (no->get_lien_segment()->get_nb()>0)
2480 {
2481 bool estjoint=false;
2482 for (int i=0;i<no->get_lien_segment()->get_nb();i++)
2483 {
2484 LISTE_MG_POUTRE::iterator itp;
2485 for (MG_POUTRE* pou=mg_geometrie->get_premier_poutre(itp);pou!=NULL;pou=mg_geometrie->get_suivant_poutre(itp))
2486 if (pou->contient_element(no->get_lien_segment()->get(i))) {estjoint=true;}
2487 }
2488 if (estjoint)
2489 {
2490 for (int i=0;i<no->get_lien_segment()->get_nb();i++)
2491 {
2492 bool bord=false;
2493 LISTE_MG_POUTRE::iterator itp;
2494 int nbele2=no->get_lien_segment()->get(i)->get_lien_triangle()->get_nb();
2495 for (int j=0;j<nbele2;j++)
2496 if (no->get_lien_segment()->get(i)->get_lien_triangle()->get(j)->get_lien_tetra()->get_nb()>0)
2497 if (no->get_lien_segment()->get(i)->get_lien_triangle()->get(j)->get_lien_tetra()->get_nb()<2) bord=true;
2498 nbele2=no->get_lien_segment()->get(i)->get_lien_quadrangle()->get_nb();
2499 for (int j=0;j<nbele2;j++)
2500 if (no->get_lien_segment()->get(i)->get_lien_quadrangle()->get(j)->get_lien_hexa()->get_nb()>0)
2501 if (no->get_lien_segment()->get(i)->get_lien_quadrangle()->get(j)->get_lien_hexa()->get_nb()<2) bord=true;
2502 if (bord==true) mini.ajouter(no->get_lien_segment()->get(i));
2503 }
2504 //std::cout << no->get_id() << " est un joint 1D-3D : " << mini.get_nb() << " mini " << std::endl;
2505
2506 }
2507 }
2508
2509 }
2510 LISTE_MG_TRIANGLE::iterator itt;
2511 for (MG_TRIANGLE* tri=maillage->get_premier_triangle(itt);tri!=NULL;tri=maillage->get_suivant_triangle(itt))
2512 if (tri->get_origine()==MAGIC::ORIGINE::SECTION)
2513 {
2514 mini.ajouter(tri->get_segment1());
2515 mini.ajouter(tri->get_segment2());
2516 mini.ajouter(tri->get_segment3());
2517 }
2518
2519 LISTE_MG_QUADRANGLE::iterator itq;
2520 for (MG_QUADRANGLE* qua=maillage->get_premier_quadrangle(itq);qua!=NULL;qua=maillage->get_suivant_quadrangle(itq))
2521 if (qua->get_origine()==MAGIC::ORIGINE::SECTION)
2522 {
2523 mini.ajouter(qua->get_segment1());
2524 mini.ajouter(qua->get_segment2());
2525 mini.ajouter(qua->get_segment3());
2526 mini.ajouter(qua->get_segment4());
2527 }
2528
2529
2530 }