ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_maillage.cpp
Revision: 883
Committed: Thu Apr 20 13:38:18 2017 UTC (8 years, 4 months ago) by francois
File size: 65212 byte(s)
Log Message:
Creation d'un mailleur FEM pour pouvoir avoir des stratégies paramétrées de maillage. L'ancienne méthode construit disparait et est remplacée par l'utilisation d'un MAILLEUR_FEM.
Stratégie de quadratisation mise en place : déplacer les noeuds pour s'assurer que les tetras quadratiques présentent une distortion au dessu d'une borne inférieure. Mais ces noeuds quittent la géométrie.

Les paramètres dans ~/.magic.

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_penta6.h"
45 #include "fem_penta15.h"
46 #include "fem_graph_noeud.h"
47 #include "mg_gestionnaire.h"
48 #include "mc_gestionnaire.h"
49 #include "mc_propriete.h"
50 #include "mc_materiau.h"
51 #include "ot_decalage_parametre.h"
52 #include "tpl_map_entite.h"
53 #include "tpl_liste_entite.h"
54 #include "fem_maillage_quadratique_outils.h"
55 //#include "message.h"
56
57
58
59 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)
60 {
61 }
62
63 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)
64 {
65 }
66
67 FEM_MAILLAGE::~FEM_MAILLAGE()
68 {
69 supprimer_tout_xfem_element3();
70 supprimer_tout_fem_element3();
71 supprimer_tout_fem_element2();
72 supprimer_tout_fem_element1();
73 supprimer_tout_fem_noeud();
74 }
75
76 FEM_MAILLAGE* FEM_MAILLAGE::dupliquer(MG_GESTIONNAIRE* gest)
77 {
78 FEM_MAILLAGE* mai=new FEM_MAILLAGE(mg_geometrie,maillage,degre);
79 gest->ajouter_fem_maillage(mai);
80 long decalage=mai->get_id()-this->get_id();
81 LISTE_ENTITE::const_iterator i;
82 for (i=lst_entite.begin();i!=lst_entite.end();i++)
83 {
84 FEM_ELEMENT_MAILLAGE& ele=(FEM_ELEMENT_MAILLAGE&)(*(*i));
85 ele.dupliquer(mai,decalage);
86 }
87 return mai;
88 }
89
90 MG_GEOMETRIE* FEM_MAILLAGE::get_mg_geometrie(void)
91 {
92 return mg_geometrie;
93 }
94
95 MG_MAILLAGE* FEM_MAILLAGE::get_mg_maillage(void)
96 {
97 return maillage;
98 }
99
100 int FEM_MAILLAGE::get_degre(void)
101 {
102 return degre;
103 }
104
105 bool FEM_MAILLAGE::contient ( MG_IDENTIFICATEUR * id )
106 {
107 return ( lst_entite.find ( id ) != lst_entite.end() );
108 }
109
110 void FEM_MAILLAGE::change_gestionnaire(MG_GESTIONNAIRE* mggest)
111 {
112 gest=mggest;
113 }
114
115 // ENTITE FEM_NOEUD
116 FEM_NOEUD* FEM_MAILLAGE::ajouter_fem_noeud(MG_NOEUD* mgnoeud,unsigned long num)
117 {
118 FEM_NOEUD* femnoeud;
119 if (num==0) femnoeud=new FEM_NOEUD(mgnoeud);
120 else femnoeud=new FEM_NOEUD(num,mgnoeud);
121 int resultat = ajouter_fem_noeud(femnoeud);
122 if (resultat==FAIL)
123 {
124 delete femnoeud;
125 return NULL;
126 }
127 return femnoeud;
128 }
129
130 int FEM_MAILLAGE::ajouter_fem_noeud(FEM_NOEUD *femnoeud)
131 {
132 gest->recherche_bonid(*femnoeud);
133 MG_IDENTIFICATEUR *id=femnoeud;
134 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
135 if (!p.second)
136 {
137 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
138 return FAIL;
139 }
140
141 std::pair<const unsigned long,FEM_NOEUD*> tmp(femnoeud->get_id(),femnoeud);
142 lst_fem_noeud.insert(tmp);
143 return OK;
144 }
145
146
147 FEM_NOEUD* FEM_MAILLAGE::get_fem_noeudid(unsigned long num)
148 {
149 LISTE_FEM_NOEUD::iterator i=lst_fem_noeud.find(num);
150 if (i==lst_fem_noeud.end())
151 {
152 // afficheur << INEXISTE << enderr;
153 return NULL;
154 }
155 return ((*i).second);
156 }
157
158
159
160 FEM_NOEUD* FEM_MAILLAGE::get_fem_noeud(unsigned int num)
161 {
162 if (!(num<lst_fem_noeud.size()))
163 {
164 // afficheur << INEXISTE << enderr;
165 return NULL;
166 }
167 LISTE_FEM_NOEUD::iterator i = lst_fem_noeud.begin();
168 std::advance(i, num);
169
170 return ((*i).second);
171 }
172
173 FEM_NOEUD* FEM_MAILLAGE::get_premier_noeud(LISTE_FEM_NOEUD::iterator & it)
174 {
175 it = lst_fem_noeud.begin();
176 if (it == lst_fem_noeud.end())
177 return NULL;
178 return it->second ;
179 }
180
181 FEM_NOEUD* FEM_MAILLAGE::get_suivant_noeud(LISTE_FEM_NOEUD::iterator & it)
182 {
183 it++;
184 if (it==lst_fem_noeud.end())
185 return NULL;
186 return it->second;
187 }
188
189 unsigned int FEM_MAILLAGE::get_nb_fem_noeud(void)
190 {
191 return lst_fem_noeud.size();
192 }
193
194
195 int FEM_MAILLAGE::supprimer_fem_noeudid(unsigned long num)
196 {
197 FEM_NOEUD* femnoeud=get_fem_noeudid(num);
198 if (femnoeud==NULL)
199 {
200 // afficheur << INEXISTE2 << enderr;
201 return FAIL;
202 }
203 MG_IDENTIFICATEUR* id=femnoeud;
204 LISTE_ENTITE::iterator i=lst_entite.find(id);
205 lst_entite.erase(i);
206 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.find(num);
207 lst_fem_noeud.erase(j);
208 delete femnoeud;
209 return OK;
210 }
211
212
213 int FEM_MAILLAGE::supprimer_fem_noeud(unsigned int num)
214 {
215 FEM_NOEUD* femnoeud=get_fem_noeud(num);
216 if (femnoeud==NULL)
217 {
218 // afficheur << INEXISTE2 << enderr;
219 return FAIL;
220 }
221 MG_IDENTIFICATEUR* id=femnoeud;
222 LISTE_ENTITE::iterator i=lst_entite.find(id);
223 lst_entite.erase(i);
224 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.begin();
225 for (unsigned int k=0;k<num;k++) j++;
226 lst_fem_noeud.erase(j);
227 delete femnoeud;
228 return OK;
229 }
230
231
232 void FEM_MAILLAGE::supprimer_tout_fem_noeud(void)
233 {
234 while (get_nb_fem_noeud()!=0)
235 {
236 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.begin();
237 FEM_NOEUD* femnoeud=(*j).second;
238 MG_IDENTIFICATEUR* id=femnoeud;
239 LISTE_ENTITE::iterator i=lst_entite.find(id);
240 lst_entite.erase(i);
241 lst_fem_noeud.erase(j);
242 delete femnoeud;
243 }
244 }
245 // ENTITE FEM_ELEMENT0
246
247
248 int FEM_MAILLAGE::ajouter_fem_element0(FEM_ELEMENT0 *femnoeud)
249 {
250 gest->recherche_bonid(*femnoeud);
251 MG_IDENTIFICATEUR *id=femnoeud;
252 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
253 if (!p.second)
254 {
255 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
256 return FAIL;
257 }
258
259 std::pair<const unsigned long,FEM_ELEMENT0*> tmp(femnoeud->get_id(),femnoeud);
260 lst_fem_element0.insert(tmp);
261 return OK;
262 }
263
264 FEM_ELEMENT0* FEM_MAILLAGE::get_fem_element0id(unsigned long num)
265 {
266 LISTE_FEM_ELEMENT0::iterator i=lst_fem_element0.find(num);
267 if (i==lst_fem_element0.end())
268 {
269 // afficheur << INEXISTE << enderr;
270 return NULL;
271 }
272 return ((*i).second);
273 }
274
275 unsigned int FEM_MAILLAGE::get_nb_fem_element0(void)
276 {
277 return lst_fem_element0.size();
278 }
279
280
281
282 FEM_ELEMENT0* FEM_MAILLAGE::get_fem_element0(unsigned int num)
283 {
284 if (!(num<lst_fem_element0.size()))
285 {
286 // afficheur << INEXISTE << enderr;
287 return NULL;
288 }
289 LISTE_FEM_ELEMENT0::iterator i=lst_fem_element0.begin();
290 for (unsigned long j=0;j<num;j++) i++;
291 return ((*i).second);
292 }
293
294
295
296 int FEM_MAILLAGE::supprimer_fem_element0id(unsigned long num)
297 {
298 FEM_ELEMENT0* fem=get_fem_element0id(num);
299 if (fem==NULL)
300 {
301 // afficheur << INEXISTE2 << enderr;
302 return FAIL;
303 }
304 MG_IDENTIFICATEUR* id=fem;
305 LISTE_ENTITE::iterator i=lst_entite.find(id);
306 lst_entite.erase(i);
307 LISTE_FEM_ELEMENT0::iterator j=lst_fem_element0.find(num);
308 lst_fem_element0.erase(j);
309 delete fem;
310 return OK;
311 }
312
313 int FEM_MAILLAGE::supprimer_fem_element0(unsigned int num)
314 {
315 FEM_ELEMENT0* fem=get_fem_element0(num);
316 if (fem==NULL)
317 {
318 // afficheur << INEXISTE2 << enderr;
319 return FAIL;
320 }
321 MG_IDENTIFICATEUR* id=fem;
322 LISTE_ENTITE::iterator i=lst_entite.find(id);
323 lst_entite.erase(i);
324 LISTE_FEM_ELEMENT0::iterator j=lst_fem_element0.find(num);
325 lst_fem_element0.erase(j);
326 delete fem;
327 return OK;
328 }
329
330 void FEM_MAILLAGE::supprimer_tout_fem_element0(void)
331 {
332 while (get_nb_fem_element0()!=0)
333 {
334 LISTE_FEM_ELEMENT0::iterator j=lst_fem_element0.begin();
335 FEM_ELEMENT0* fem=(*j).second;
336 MG_IDENTIFICATEUR* id=fem;
337 LISTE_ENTITE::iterator i=lst_entite.find(id);
338 lst_entite.erase(i);
339 lst_fem_element0.erase(j);
340 delete fem;
341 }
342 }
343
344
345 FEM_ELEMENT0* FEM_MAILLAGE::get_premier_element0(LISTE_FEM_ELEMENT0::iterator & it)
346 {
347 it = lst_fem_element0.begin();
348 if (it == lst_fem_element0.end())
349 return NULL;
350 return it->second ;
351 }
352
353 FEM_ELEMENT0* FEM_MAILLAGE::get_suivant_element0(LISTE_FEM_ELEMENT0::iterator & it)
354 {
355 it++;
356 if (it==lst_fem_element0.end())
357 return NULL;
358 return it->second;
359 }
360
361
362 // ENTITE FEM_ELEMENT1
363
364
365 int FEM_MAILLAGE::ajouter_fem_element1(FEM_ELEMENT1 *femsegment)
366 {
367 gest->recherche_bonid(*femsegment);
368 MG_IDENTIFICATEUR *id=femsegment;
369 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
370 if (!p.second)
371 {
372 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
373 return FAIL;
374 }
375
376 std::pair<const unsigned long,FEM_ELEMENT1*> tmp(femsegment->get_id(),femsegment);
377 lst_fem_element1.insert(tmp);
378 return OK;
379 }
380
381 FEM_ELEMENT1* FEM_MAILLAGE::get_fem_element1id(unsigned long num)
382 {
383 LISTE_FEM_ELEMENT1::iterator i=lst_fem_element1.find(num);
384 if (i==lst_fem_element1.end())
385 {
386 // afficheur << INEXISTE << enderr;
387 return NULL;
388 }
389 return ((*i).second);
390 }
391
392 unsigned int FEM_MAILLAGE::get_nb_fem_element1(void)
393 {
394 return lst_fem_element1.size();
395 }
396
397
398
399 FEM_ELEMENT1* FEM_MAILLAGE::get_fem_element1(unsigned int num)
400 {
401 if (!(num<lst_fem_element1.size()))
402 {
403 // afficheur << INEXISTE << enderr;
404 return NULL;
405 }
406 LISTE_FEM_ELEMENT1::iterator i=lst_fem_element1.begin();
407 for (unsigned long j=0;j<num;j++) i++;
408 return ((*i).second);
409 }
410
411
412
413 int FEM_MAILLAGE::supprimer_fem_element1id(unsigned long num)
414 {
415 FEM_ELEMENT1* femsegment=get_fem_element1id(num);
416 if (femsegment==NULL)
417 {
418 // afficheur << INEXISTE2 << enderr;
419 return FAIL;
420 }
421 MG_IDENTIFICATEUR* id=femsegment;
422 LISTE_ENTITE::iterator i=lst_entite.find(id);
423 lst_entite.erase(i);
424 LISTE_FEM_ELEMENT1::iterator j=lst_fem_element1.find(num);
425 lst_fem_element1.erase(j);
426 delete femsegment;
427 return OK;
428 }
429
430 int FEM_MAILLAGE::supprimer_fem_element1(unsigned int num)
431 {
432 FEM_ELEMENT1* femsegment=get_fem_element1(num);
433 if (femsegment==NULL)
434 {
435 // afficheur << INEXISTE2 << enderr;
436 return FAIL;
437 }
438 MG_IDENTIFICATEUR* id=femsegment;
439 LISTE_ENTITE::iterator i=lst_entite.find(id);
440 lst_entite.erase(i);
441 LISTE_FEM_ELEMENT1::iterator j=lst_fem_element1.find(num);
442 lst_fem_element1.erase(j);
443 delete femsegment;
444 return OK;
445 }
446
447 void FEM_MAILLAGE::supprimer_tout_fem_element1(void)
448 {
449 while (get_nb_fem_element1()!=0)
450 {
451 LISTE_FEM_ELEMENT1::iterator j=lst_fem_element1.begin();
452 FEM_ELEMENT1* femsegment=(*j).second;
453 MG_IDENTIFICATEUR* id=femsegment;
454 LISTE_ENTITE::iterator i=lst_entite.find(id);
455 lst_entite.erase(i);
456 lst_fem_element1.erase(j);
457 delete femsegment;
458 }
459 }
460
461
462 FEM_ELEMENT1* FEM_MAILLAGE::get_premier_element1(LISTE_FEM_ELEMENT1::iterator & it)
463 {
464 it = lst_fem_element1.begin();
465 if (it == lst_fem_element1.end())
466 return NULL;
467 return it->second ;
468 }
469
470 FEM_ELEMENT1* FEM_MAILLAGE::get_suivant_element1(LISTE_FEM_ELEMENT1::iterator & it)
471 {
472 it++;
473 if (it==lst_fem_element1.end())
474 return NULL;
475 return it->second;
476 }
477
478
479
480 // ENTITE FEM_ELEMENT2
481
482
483 int FEM_MAILLAGE::ajouter_fem_element2(FEM_ELEMENT2 *femtriangle)
484 {
485 gest->recherche_bonid(*femtriangle);
486 MG_IDENTIFICATEUR *id=femtriangle;
487 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
488 if (!p.second)
489 {
490 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
491 return FAIL;
492 }
493
494 std::pair<const unsigned long,FEM_ELEMENT2*> tmp(femtriangle->get_id(),femtriangle);
495 lst_fem_element2.insert(tmp);
496 return OK;
497 }
498
499 FEM_ELEMENT2* FEM_MAILLAGE::get_fem_element2id(unsigned long num)
500 {
501 LISTE_FEM_ELEMENT2::iterator i=lst_fem_element2.find(num);
502 if (i==lst_fem_element2.end())
503 {
504 // afficheur << INEXISTE << enderr;
505 return NULL;
506 }
507 return ((*i).second);
508 }
509
510 unsigned int FEM_MAILLAGE::get_nb_fem_element2(void)
511 {
512 return lst_fem_element2.size();
513 }
514
515
516
517 FEM_ELEMENT2* FEM_MAILLAGE::get_fem_element2(unsigned int num)
518 {
519 if (!(num<lst_fem_element2.size()))
520 {
521 // afficheur << INEXISTE << enderr;
522 return NULL;
523 }
524 LISTE_FEM_ELEMENT2::iterator i=lst_fem_element2.begin();
525 for (unsigned long j=0;j<num;j++) i++;
526 return ((*i).second);
527 }
528
529
530
531 int FEM_MAILLAGE::supprimer_fem_element2id(unsigned long num)
532 {
533 FEM_ELEMENT2* femtriangle=get_fem_element2id(num);
534 if (femtriangle==NULL)
535 {
536 // afficheur << INEXISTE2 << enderr;
537 return FAIL;
538 }
539 MG_IDENTIFICATEUR* id=femtriangle;
540 LISTE_ENTITE::iterator i=lst_entite.find(id);
541 lst_entite.erase(i);
542 LISTE_FEM_ELEMENT2::iterator j=lst_fem_element2.find(num);
543 lst_fem_element2.erase(j);
544 delete femtriangle;
545 return OK;
546 }
547
548 int FEM_MAILLAGE::supprimer_fem_element2(unsigned int num)
549 {
550 FEM_ELEMENT2* femtriangle=get_fem_element2(num);
551 if (femtriangle==NULL)
552 {
553 // afficheur << INEXISTE2 << enderr;
554 return FAIL;
555 }
556 MG_IDENTIFICATEUR* id=femtriangle;
557 LISTE_ENTITE::iterator i=lst_entite.find(id);
558 lst_entite.erase(i);
559 LISTE_FEM_ELEMENT2::iterator j=lst_fem_element2.find(num);
560 lst_fem_element2.erase(j);
561 delete femtriangle;
562 return OK;
563 }
564
565 void FEM_MAILLAGE::supprimer_tout_fem_element2(void)
566 {
567 while (get_nb_fem_element2()!=0)
568 {
569 LISTE_FEM_ELEMENT2::iterator j=lst_fem_element2.begin();
570 FEM_ELEMENT2* femtriangle=(*j).second;
571 MG_IDENTIFICATEUR* id=femtriangle;
572 LISTE_ENTITE::iterator i=lst_entite.find(id);
573 lst_entite.erase(i);
574 lst_fem_element2.erase(j);
575 delete femtriangle;
576 }
577 }
578
579
580 FEM_ELEMENT2* FEM_MAILLAGE::get_premier_element2(LISTE_FEM_ELEMENT2::iterator & it)
581 {
582 it = lst_fem_element2.begin();
583 if (it == lst_fem_element2.end())
584 return NULL;
585 return it->second ;
586 }
587
588 FEM_ELEMENT2* FEM_MAILLAGE::get_suivant_element2(LISTE_FEM_ELEMENT2::iterator & it)
589 {
590 it++;
591 if (it==lst_fem_element2.end())
592 return NULL;
593 return it->second;
594 }
595
596
597 // ENTITE FEM_TETRA
598
599
600 int FEM_MAILLAGE::ajouter_fem_element3(FEM_ELEMENT3 *femele)
601 {
602 gest->recherche_bonid(*femele);
603 MG_IDENTIFICATEUR *id=femele;
604 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
605 if (!p.second)
606 {
607 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
608 return FAIL;
609 }
610
611 std::pair<const unsigned long,FEM_ELEMENT3*> tmp(femele->get_id(),femele);
612 lst_fem_element3.insert(tmp);
613 return OK;
614 }
615
616 FEM_ELEMENT3* FEM_MAILLAGE::get_fem_element3id(unsigned long num)
617 {
618 LISTE_FEM_ELEMENT3::iterator i=lst_fem_element3.find(num);
619 if (i==lst_fem_element3.end())
620 {
621 // afficheur << INEXISTE << enderr;
622 return NULL;
623 }
624 return ((*i).second);
625 }
626
627 unsigned int FEM_MAILLAGE::get_nb_fem_element3(void)
628 {
629 return lst_fem_element3.size();
630 }
631
632
633
634 FEM_ELEMENT3* FEM_MAILLAGE::get_fem_element3(unsigned int num)
635 {
636 if (!(num<lst_fem_element3.size()))
637 {
638 // afficheur << INEXISTE << enderr;
639 return NULL;
640 }
641 LISTE_FEM_ELEMENT3::iterator i=lst_fem_element3.begin();
642 for (unsigned long j=0;j<num;j++) i++;
643 return ((*i).second);
644 }
645
646
647
648 int FEM_MAILLAGE::supprimer_fem_element3id(unsigned long num)
649 {
650 FEM_ELEMENT3* femele=get_fem_element3id(num);
651 if (femele==NULL)
652 {
653 // afficheur << INEXISTE2 << enderr;
654 return FAIL;
655 }
656 MG_IDENTIFICATEUR* id=femele;
657 LISTE_ENTITE::iterator i=lst_entite.find(id);
658 lst_entite.erase(i);
659 LISTE_FEM_ELEMENT3::iterator j=lst_fem_element3.find(num);
660 lst_fem_element3.erase(j);
661 delete femele;
662 return OK;
663 }
664
665 int FEM_MAILLAGE::supprimer_fem_element3(unsigned int num)
666 {
667 FEM_ELEMENT3* femele=get_fem_element3(num);
668 if (femele==NULL)
669 {
670 // afficheur << INEXISTE2 << enderr;
671 return FAIL;
672 }
673 MG_IDENTIFICATEUR* id=femele;
674 LISTE_ENTITE::iterator i=lst_entite.find(id);
675 lst_entite.erase(i);
676 LISTE_FEM_ELEMENT3::iterator j=lst_fem_element3.find(num);
677 lst_fem_element3.erase(j);
678 delete femele;
679 return OK;
680 }
681
682 void FEM_MAILLAGE::supprimer_tout_fem_element3(void)
683 {
684 while (get_nb_fem_element3()!=0)
685 {
686 LISTE_FEM_ELEMENT3::iterator j=lst_fem_element3.begin();
687 FEM_ELEMENT3* femele=(*j).second;
688 MG_IDENTIFICATEUR* id=femele;
689 LISTE_ENTITE::iterator i=lst_entite.find(id);
690 lst_entite.erase(i);
691 lst_fem_element3.erase(j);
692 delete femele;
693 }
694 }
695
696
697 FEM_ELEMENT3* FEM_MAILLAGE::get_premier_element3(LISTE_FEM_ELEMENT3::iterator & it)
698 {
699 it = lst_fem_element3.begin();
700 if (it == lst_fem_element3.end())
701 return NULL;
702 return it->second ;
703 }
704
705 FEM_ELEMENT3* FEM_MAILLAGE::get_suivant_element3(LISTE_FEM_ELEMENT3::iterator & it)
706 {
707 it++;
708 if (it==lst_fem_element3.end())
709 return NULL;
710 return it->second;
711 }
712
713 // ENTITE XFEM_ELEMENT0
714
715
716 int FEM_MAILLAGE::ajouter_xfem_element0(XFEM_ELEMENT0 *femele)
717 {
718 gest->recherche_bonid(*femele);
719 MG_IDENTIFICATEUR *id=femele;
720 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
721 if (!p.second)
722 {
723 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
724 return FAIL;
725 }
726
727 std::pair<const unsigned long,XFEM_ELEMENT0*> tmp(femele->get_id(),femele);
728 lst_xfem_element0.insert(tmp);
729 return OK;
730 }
731
732 XFEM_ELEMENT0* FEM_MAILLAGE::get_xfem_element0id(unsigned long num)
733 {
734 LISTE_XFEM_ELEMENT0::iterator i=lst_xfem_element0.find(num);
735 if (i==lst_xfem_element0.end())
736 {
737 // afficheur << INEXISTE << enderr;
738 return NULL;
739 }
740 return ((*i).second);
741 }
742
743 unsigned int FEM_MAILLAGE::get_nb_xfem_element0(void)
744 {
745 return lst_xfem_element0.size();
746 }
747
748
749
750 XFEM_ELEMENT0* FEM_MAILLAGE::get_xfem_element0(unsigned int num)
751 {
752 if (!(num<lst_xfem_element0.size()))
753 {
754 // afficheur << INEXISTE << enderr;
755 return NULL;
756 }
757 LISTE_XFEM_ELEMENT0::iterator i=lst_xfem_element0.begin();
758 for (unsigned long j=0;j<num;j++) i++;
759 return ((*i).second);
760 }
761
762
763
764 int FEM_MAILLAGE::supprimer_xfem_element0id(unsigned long num)
765 {
766 XFEM_ELEMENT0* femele=get_xfem_element0id(num);
767 if (femele==NULL)
768 {
769 // afficheur << INEXISTE2 << enderr;
770 return FAIL;
771 }
772 MG_IDENTIFICATEUR* id=femele;
773 LISTE_ENTITE::iterator i=lst_entite.find(id);
774 lst_entite.erase(i);
775 LISTE_XFEM_ELEMENT0::iterator j=lst_xfem_element0.find(num);
776 lst_xfem_element0.erase(j);
777 delete femele;
778 return OK;
779 }
780
781 int FEM_MAILLAGE::supprimer_xfem_element0(unsigned int num)
782 {
783 XFEM_ELEMENT0* femele=get_xfem_element0(num);
784 if (femele==NULL)
785 {
786 // afficheur << INEXISTE2 << enderr;
787 return FAIL;
788 }
789 MG_IDENTIFICATEUR* id=femele;
790 LISTE_ENTITE::iterator i=lst_entite.find(id);
791 lst_entite.erase(i);
792 LISTE_XFEM_ELEMENT0::iterator j=lst_xfem_element0.find(num);
793 lst_xfem_element0.erase(j);
794 delete femele;
795 return OK;
796 }
797
798 void FEM_MAILLAGE::supprimer_tout_xfem_element0(void)
799 {
800 while (get_nb_xfem_element0()!=0)
801 {
802 LISTE_XFEM_ELEMENT0::iterator j=lst_xfem_element0.begin();
803 XFEM_ELEMENT0* femele=(*j).second;
804 MG_IDENTIFICATEUR* id=femele;
805 LISTE_ENTITE::iterator i=lst_entite.find(id);
806 lst_entite.erase(i);
807 lst_xfem_element0.erase(j);
808 delete femele;
809 }
810 }
811
812
813 XFEM_ELEMENT0* FEM_MAILLAGE::get_premier_xelement0(LISTE_XFEM_ELEMENT0::iterator & it)
814 {
815 it = lst_xfem_element0.begin();
816 if (it == lst_xfem_element0.end())
817 return NULL;
818 return it->second ;
819 }
820
821 XFEM_ELEMENT0* FEM_MAILLAGE::get_suivant_xelement0(LISTE_XFEM_ELEMENT0::iterator & it)
822 {
823 it++;
824 if (it==lst_xfem_element0.end())
825 return NULL;
826 return it->second;
827 }
828
829
830 // ENTITE XFEM_ELEMENT1
831
832
833 int FEM_MAILLAGE::ajouter_xfem_element1(XFEM_ELEMENT1 *femele)
834 {
835 gest->recherche_bonid(*femele);
836 MG_IDENTIFICATEUR *id=femele;
837 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
838 if (!p.second)
839 {
840 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
841 return FAIL;
842 }
843
844 std::pair<const unsigned long,XFEM_ELEMENT1*> tmp(femele->get_id(),femele);
845 lst_xfem_element1.insert(tmp);
846 return OK;
847 }
848
849 XFEM_ELEMENT1* FEM_MAILLAGE::get_xfem_element1id(unsigned long num)
850 {
851 LISTE_XFEM_ELEMENT1::iterator i=lst_xfem_element1.find(num);
852 if (i==lst_xfem_element1.end())
853 {
854 // afficheur << INEXISTE << enderr;
855 return NULL;
856 }
857 return ((*i).second);
858 }
859
860 unsigned int FEM_MAILLAGE::get_nb_xfem_element1(void)
861 {
862 return lst_xfem_element1.size();
863 }
864
865
866
867 XFEM_ELEMENT1* FEM_MAILLAGE::get_xfem_element1(unsigned int num)
868 {
869 if (!(num<lst_xfem_element1.size()))
870 {
871 // afficheur << INEXISTE << enderr;
872 return NULL;
873 }
874 LISTE_XFEM_ELEMENT1::iterator i=lst_xfem_element1.begin();
875 for (unsigned long j=0;j<num;j++) i++;
876 return ((*i).second);
877 }
878
879
880
881 int FEM_MAILLAGE::supprimer_xfem_element1id(unsigned long num)
882 {
883 XFEM_ELEMENT1* femele=get_xfem_element1id(num);
884 if (femele==NULL)
885 {
886 // afficheur << INEXISTE2 << enderr;
887 return FAIL;
888 }
889 MG_IDENTIFICATEUR* id=femele;
890 LISTE_ENTITE::iterator i=lst_entite.find(id);
891 lst_entite.erase(i);
892 LISTE_XFEM_ELEMENT1::iterator j=lst_xfem_element1.find(num);
893 lst_xfem_element1.erase(j);
894 delete femele;
895 return OK;
896 }
897
898 int FEM_MAILLAGE::supprimer_xfem_element1(unsigned int num)
899 {
900 XFEM_ELEMENT1* femele=get_xfem_element1(num);
901 if (femele==NULL)
902 {
903 // afficheur << INEXISTE2 << enderr;
904 return FAIL;
905 }
906 MG_IDENTIFICATEUR* id=femele;
907 LISTE_ENTITE::iterator i=lst_entite.find(id);
908 lst_entite.erase(i);
909 LISTE_XFEM_ELEMENT1::iterator j=lst_xfem_element1.find(num);
910 lst_xfem_element1.erase(j);
911 delete femele;
912 return OK;
913 }
914
915 void FEM_MAILLAGE::supprimer_tout_xfem_element1(void)
916 {
917 while (get_nb_xfem_element1()!=0)
918 {
919 LISTE_XFEM_ELEMENT1::iterator j=lst_xfem_element1.begin();
920 XFEM_ELEMENT1* femele=(*j).second;
921 MG_IDENTIFICATEUR* id=femele;
922 LISTE_ENTITE::iterator i=lst_entite.find(id);
923 lst_entite.erase(i);
924 lst_xfem_element1.erase(j);
925 delete femele;
926 }
927 }
928
929
930 XFEM_ELEMENT1* FEM_MAILLAGE::get_premier_xelement1(LISTE_XFEM_ELEMENT1::iterator & it)
931 {
932 it = lst_xfem_element1.begin();
933 if (it == lst_xfem_element1.end())
934 return NULL;
935 return it->second ;
936 }
937
938 XFEM_ELEMENT1* FEM_MAILLAGE::get_suivant_xelement1(LISTE_XFEM_ELEMENT1::iterator & it)
939 {
940 it++;
941 if (it==lst_xfem_element1.end())
942 return NULL;
943 return it->second;
944 }
945
946
947
948 // ENTITE XFEM_ELEMENT2
949
950
951 int FEM_MAILLAGE::ajouter_xfem_element2(XFEM_ELEMENT2 *femele)
952 {
953 gest->recherche_bonid(*femele);
954 MG_IDENTIFICATEUR *id=femele;
955 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
956 if (!p.second)
957 {
958 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
959 return FAIL;
960 }
961
962 std::pair<const unsigned long,XFEM_ELEMENT2*> tmp(femele->get_id(),femele);
963 lst_xfem_element2.insert(tmp);
964 return OK;
965 }
966
967 XFEM_ELEMENT2* FEM_MAILLAGE::get_xfem_element2id(unsigned long num)
968 {
969 LISTE_XFEM_ELEMENT2::iterator i=lst_xfem_element2.find(num);
970 if (i==lst_xfem_element2.end())
971 {
972 // afficheur << INEXISTE << enderr;
973 return NULL;
974 }
975 return ((*i).second);
976 }
977
978 unsigned int FEM_MAILLAGE::get_nb_xfem_element2(void)
979 {
980 return lst_xfem_element2.size();
981 }
982
983
984
985 XFEM_ELEMENT2* FEM_MAILLAGE::get_xfem_element2(unsigned int num)
986 {
987 if (!(num<lst_xfem_element2.size()))
988 {
989 // afficheur << INEXISTE << enderr;
990 return NULL;
991 }
992 LISTE_XFEM_ELEMENT2::iterator i=lst_xfem_element2.begin();
993 for (unsigned long j=0;j<num;j++) i++;
994 return ((*i).second);
995 }
996
997
998
999 int FEM_MAILLAGE::supprimer_xfem_element2id(unsigned long num)
1000 {
1001 XFEM_ELEMENT2* femele=get_xfem_element2id(num);
1002 if (femele==NULL)
1003 {
1004 // afficheur << INEXISTE2 << enderr;
1005 return FAIL;
1006 }
1007 MG_IDENTIFICATEUR* id=femele;
1008 LISTE_ENTITE::iterator i=lst_entite.find(id);
1009 lst_entite.erase(i);
1010 LISTE_XFEM_ELEMENT2::iterator j=lst_xfem_element2.find(num);
1011 lst_xfem_element2.erase(j);
1012 delete femele;
1013 return OK;
1014 }
1015
1016 int FEM_MAILLAGE::supprimer_xfem_element2(unsigned int num)
1017 {
1018 XFEM_ELEMENT2* femele=get_xfem_element2(num);
1019 if (femele==NULL)
1020 {
1021 // afficheur << INEXISTE2 << enderr;
1022 return FAIL;
1023 }
1024 MG_IDENTIFICATEUR* id=femele;
1025 LISTE_ENTITE::iterator i=lst_entite.find(id);
1026 lst_entite.erase(i);
1027 LISTE_XFEM_ELEMENT2::iterator j=lst_xfem_element2.find(num);
1028 lst_xfem_element2.erase(j);
1029 delete femele;
1030 return OK;
1031 }
1032
1033 void FEM_MAILLAGE::supprimer_tout_xfem_element2(void)
1034 {
1035 while (get_nb_xfem_element2()!=0)
1036 {
1037 LISTE_XFEM_ELEMENT2::iterator j=lst_xfem_element2.begin();
1038 XFEM_ELEMENT2* femele=(*j).second;
1039 MG_IDENTIFICATEUR* id=femele;
1040 LISTE_ENTITE::iterator i=lst_entite.find(id);
1041 lst_entite.erase(i);
1042 lst_xfem_element2.erase(j);
1043 delete femele;
1044 }
1045 }
1046
1047
1048 XFEM_ELEMENT2* FEM_MAILLAGE::get_premier_xelement2(LISTE_XFEM_ELEMENT2::iterator & it)
1049 {
1050 it = lst_xfem_element2.begin();
1051 if (it == lst_xfem_element2.end())
1052 return NULL;
1053 return it->second ;
1054 }
1055
1056 XFEM_ELEMENT2* FEM_MAILLAGE::get_suivant_xelement2(LISTE_XFEM_ELEMENT2::iterator & it)
1057 {
1058 it++;
1059 if (it==lst_xfem_element2.end())
1060 return NULL;
1061 return it->second;
1062 }
1063
1064
1065
1066 // ENTITE XFEM_ELEMENT3
1067
1068
1069 int FEM_MAILLAGE::ajouter_xfem_element3(XFEM_ELEMENT3 *femele)
1070 {
1071 gest->recherche_bonid(*femele);
1072 MG_IDENTIFICATEUR *id=femele;
1073 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
1074 if (!p.second)
1075 {
1076 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
1077 return FAIL;
1078 }
1079
1080 std::pair<const unsigned long,XFEM_ELEMENT3*> tmp(femele->get_id(),femele);
1081 lst_xfem_element3.insert(tmp);
1082 return OK;
1083 }
1084
1085 XFEM_ELEMENT3* FEM_MAILLAGE::get_xfem_element3id(unsigned long num)
1086 {
1087 LISTE_XFEM_ELEMENT3::iterator i=lst_xfem_element3.find(num);
1088 if (i==lst_xfem_element3.end())
1089 {
1090 // afficheur << INEXISTE << enderr;
1091 return NULL;
1092 }
1093 return ((*i).second);
1094 }
1095
1096 unsigned int FEM_MAILLAGE::get_nb_xfem_element3(void)
1097 {
1098 return lst_xfem_element3.size();
1099 }
1100
1101
1102
1103 XFEM_ELEMENT3* FEM_MAILLAGE::get_xfem_element3(unsigned int num)
1104 {
1105 if (!(num<lst_xfem_element3.size()))
1106 {
1107 // afficheur << INEXISTE << enderr;
1108 return NULL;
1109 }
1110 LISTE_XFEM_ELEMENT3::iterator i=lst_xfem_element3.begin();
1111 for (unsigned long j=0;j<num;j++) i++;
1112 return ((*i).second);
1113 }
1114
1115
1116
1117 int FEM_MAILLAGE::supprimer_xfem_element3id(unsigned long num)
1118 {
1119 XFEM_ELEMENT3* femele=get_xfem_element3id(num);
1120 if (femele==NULL)
1121 {
1122 // afficheur << INEXISTE2 << enderr;
1123 return FAIL;
1124 }
1125 MG_IDENTIFICATEUR* id=femele;
1126 LISTE_ENTITE::iterator i=lst_entite.find(id);
1127 lst_entite.erase(i);
1128 LISTE_XFEM_ELEMENT3::iterator j=lst_xfem_element3.find(num);
1129 lst_xfem_element3.erase(j);
1130 delete femele;
1131 return OK;
1132 }
1133
1134 int FEM_MAILLAGE::supprimer_xfem_element3(unsigned int num)
1135 {
1136 XFEM_ELEMENT3* femele=get_xfem_element3(num);
1137 if (femele==NULL)
1138 {
1139 // afficheur << INEXISTE2 << enderr;
1140 return FAIL;
1141 }
1142 MG_IDENTIFICATEUR* id=femele;
1143 LISTE_ENTITE::iterator i=lst_entite.find(id);
1144 lst_entite.erase(i);
1145 LISTE_XFEM_ELEMENT3::iterator j=lst_xfem_element3.find(num);
1146 lst_xfem_element3.erase(j);
1147 delete femele;
1148 return OK;
1149 }
1150
1151 void FEM_MAILLAGE::supprimer_tout_xfem_element3(void)
1152 {
1153 while (get_nb_xfem_element3()!=0)
1154 {
1155 LISTE_XFEM_ELEMENT3::iterator j=lst_xfem_element3.begin();
1156 XFEM_ELEMENT3* femele=(*j).second;
1157 MG_IDENTIFICATEUR* id=femele;
1158 LISTE_ENTITE::iterator i=lst_entite.find(id);
1159 lst_entite.erase(i);
1160 lst_xfem_element3.erase(j);
1161 delete femele;
1162 }
1163 }
1164
1165
1166 XFEM_ELEMENT3* FEM_MAILLAGE::get_premier_xelement3(LISTE_XFEM_ELEMENT3::iterator & it)
1167 {
1168 it = lst_xfem_element3.begin();
1169 if (it == lst_xfem_element3.end())
1170 return NULL;
1171 return it->second ;
1172 }
1173
1174 XFEM_ELEMENT3* FEM_MAILLAGE::get_suivant_xelement3(LISTE_XFEM_ELEMENT3::iterator & it)
1175 {
1176 it++;
1177 if (it==lst_xfem_element3.end())
1178 return NULL;
1179 return it->second;
1180 }
1181
1182
1183
1184
1185 void FEM_MAILLAGE::enregistrer(std::ostream& o,double version)
1186 {
1187
1188 if (est_structure==true)
1189 {
1190 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;
1191 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;
1192
1193 }
1194 else
1195 {
1196 if (mg_geometrie==NULL) o << "%" << get_id() << "=FEM_MAILLAGE(" << degre << ",$" << maillage->get_id() << " );" << std::endl;
1197 else o << "%" << get_id() << "=FEM_MAILLAGE("<< degre << ",$" << maillage->get_id() << ",$" << mg_geometrie->get_id() <<");" << std::endl;
1198 }
1199
1200
1201 LISTE_ENTITE::const_iterator i;
1202 for (i=lst_entite.begin();i!=lst_entite.end();i++)
1203 (*i)->enregistrer(o,version);
1204 }
1205
1206
1207 void FEM_MAILLAGE::exporter_cosmos(std::string& nomfic)
1208 {
1209 char chaine[500];
1210 sprintf(chaine,"%s.ses",nomfic.c_str());
1211 std::ofstream of1(chaine,std::ios::out|std::ios::trunc);
1212 of1.precision(16);
1213 of1.setf(std::ios::showpoint);
1214 of1 << "TITLE, " << chaine << " : Fichier FEM de maillage MAGiC" << std::endl;
1215 if (degre==1) of1 << "EGROUP,1,TETRA4,0,0,0,0,0,0,0,0;" << std::endl;
1216 if (degre==2) of1 << "EGROUP,1,TETRA10,0,0,0,0,0,0,0,0;" << std::endl;
1217 int nb_volume=mg_geometrie->get_nb_mg_volume();
1218 int nbNoeuds = 0;
1219
1220
1221 for (int i=0;i<nb_volume;i++)
1222 {
1223 MG_VOLUME *mgvol=mg_geometrie->get_mg_volume(i);
1224 if (mgvol->get_num_materiau()>=0)
1225 {
1226 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
1227 MC_MATERIAU* mat=mtgest.get_materiau(mgvol->get_num_materiau());
1228 for (int m=0; m<mat->get_nb_propriete();m++)
1229 {
1230 MC_PROPRIETE* prop=mat->get_propriete(m);
1231 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
1232 }
1233 /* MT_PROPRIETE* prop=mat->get_propriete("EX");
1234 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", EX, " << prop->get_valeur(2) << ";" << std::endl;
1235 prop=mat->get_propriete("NUXY");
1236 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", NUXY, " << prop->get_valeur(2) << ";" << std::endl;
1237 prop=mat->get_propriete("GXY");
1238 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", GXY, " << prop->get_valeur(2) << ";" << std::endl;
1239 prop=mat->get_propriete("DENS");
1240 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", DENS, " << prop->get_valeur(2) << ";" << std::endl;
1241 prop=mat->get_propriete("SIGXT");
1242 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", SIGXT, " << prop->get_valeur(2) << ";" << std::endl;
1243 prop=mat->get_propriete("SIGYLD");
1244 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", SIGYLD, " << prop->get_valeur(2) << ";" << std::endl;
1245 prop=mat->get_propriete("ALPX");
1246 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", ALPX, " << prop->get_valeur(2) << ";" << std::endl;
1247 prop=mat->get_propriete("KX");
1248 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", KX, " << prop->get_valeur(2) << ";" << std::endl;
1249 prop=mat->get_propriete("C");
1250 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", C , " << prop->get_valeur(2) << ";" << std::endl;*/
1251 }
1252 }
1253 int nb_coques = mg_geometrie->get_nb_mg_coque();
1254 for (int i=0;i<nb_coques;i++)
1255 {
1256 MG_COQUE *mgcoque=mg_geometrie->get_mg_coque(i);
1257 if (mgcoque->get_num_materiau()>=0)
1258 {
1259 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
1260 MC_MATERIAU* mat=mtgest.get_materiau(mgcoque->get_num_materiau());
1261 for (int m=0; m<mat->get_nb_propriete();m++)
1262 {
1263 MC_PROPRIETE* prop=mat->get_propriete(m);
1264 of1<< "MPROP, "<< mgcoque->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
1265 }
1266 }
1267 }
1268 int nb_poutres = mg_geometrie->get_nb_mg_poutre();
1269 for (int i=0;i<nb_poutres;i++)
1270 {
1271 MG_POUTRE *mgpoutre=mg_geometrie->get_mg_poutre(i);
1272 if (mgpoutre->get_num_materiau()>=0)
1273 {
1274 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
1275 MC_MATERIAU* mat=mtgest.get_materiau(mgpoutre->get_num_materiau());
1276
1277 for (int m=0; m<mat->get_nb_propriete();m++)
1278 {
1279 MC_PROPRIETE* prop=mat->get_propriete(m);
1280 of1<< "MPROP, "<< mgpoutre->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
1281 }
1282 }
1283 }
1284
1285
1286
1287 of1 << "ACTSET,CS,0;" << std::endl;
1288 of1 << "ACTSET,EG,1;" << std::endl;
1289
1290 // �riture des noeuds
1291 int ii=0;
1292 double valeurunite=mg_geometrie->get_valeur_unite();
1293 for (LISTE_FEM_NOEUD::iterator i=lst_fem_noeud.begin();i!=lst_fem_noeud.end();i++)
1294 {
1295 FEM_NOEUD* noeud=((*i).second);
1296 of1 << "ND, " << noeud->get_numero() << ", " << noeud->get_x()*valeurunite << ", " << noeud->get_y()*valeurunite << ", " << noeud->get_z()*valeurunite << ";" << std::endl;
1297 char nom[3];
1298 int nb=noeud->get_lien_topologie()->get_nb_ccf();
1299 for (int k=0;k<nb;k++)
1300 {
1301 noeud->get_lien_topologie()->get_type_ccf(k,nom);
1302 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;
1303 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;
1304 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;
1305 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;
1306 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;
1307 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;
1308 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;
1309 }
1310 ii++;
1311 }
1312 nbNoeuds = ii;
1313 ii=0;
1314
1315 // �criture des t�tra�dres
1316 int nummat=-10; // num�o du mat�iau
1317 for (LISTE_FEM_ELEMENT3::iterator i=lst_fem_element3.begin();i!=lst_fem_element3.end();i++)
1318 {
1319 FEM_ELEMENT3* tetra=((*i).second);
1320 MG_VOLUME* vol=(MG_VOLUME*)tetra->get_lien_topologie();
1321 int nummatac=vol->get_num_materiau();
1322 if ((nummatac!=nummat) && (nummatac!=-1))
1323 {
1324 nummat=nummatac;
1325 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
1326 }
1327 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() << ", " ;
1328 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() << ", " ;
1329 ii++;
1330 MG_TETRA* tet=(MG_TETRA*)tetra->get_mg_element_maillage();
1331 if (tet->get_triangle1()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
1332 else of1 << "0, ";
1333 if (tet->get_triangle2()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
1334 else of1 << "0, ";
1335 if (tet->get_triangle3()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
1336 else of1 << "0, ";
1337 if (tet->get_triangle4()->get_lien_topologie()->get_dimension()!=3) of1 << "1;" << std::endl ;
1338 else of1 << "0;" << std::endl;
1339 char nom[3];
1340 int nb=tet->get_triangle1()->get_lien_topologie()->get_nb_ccf();
1341 for (int k=0;k<nb;k++)
1342 {
1343 tet->get_triangle1()->get_lien_topologie()->get_type_ccf(k,nom);
1344 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 1;" << std::endl;
1345 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 2;" << std::endl;
1346 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 3;" << std::endl;
1347 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 4;" << std::endl;
1348 }
1349 nb=tet->get_triangle2()->get_lien_topologie()->get_nb_ccf();
1350 for (int k=0;k<nb;k++)
1351 {
1352 tet->get_triangle2()->get_lien_topologie()->get_type_ccf(k,nom);
1353 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 1;" << std::endl;
1354 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 2;" << std::endl;
1355 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 3;" << std::endl;
1356 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 4;" << std::endl;
1357 }
1358 nb=tet->get_triangle3()->get_lien_topologie()->get_nb_ccf();
1359 for (int k=0;k<nb;k++)
1360 {
1361 tet->get_triangle3()->get_lien_topologie()->get_type_ccf(k,nom);
1362 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 1;" << std::endl;
1363 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 2;" << std::endl;
1364 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 3;" << std::endl;
1365 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 4;" << std::endl;
1366 }
1367 nb=tet->get_triangle4()->get_lien_topologie()->get_nb_ccf();
1368 for (int k=0;k<nb;k++)
1369 {
1370 tet->get_triangle4()->get_lien_topologie()->get_type_ccf(k,nom);
1371 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 1;" << std::endl;
1372 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 2;" << std::endl;
1373 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 3;" << std::endl;
1374 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 4;" << std::endl;
1375 }
1376 }
1377
1378
1379 //*********************************************************
1380 // Les t�tras sont finis, maintenant le maillage des Coques
1381 //*********************************************************
1382 //nb_coques=mg_geometrie->get_nb_mg_coque(); //variable d��d�lar� plus haut, elle devrait avoir conserv�sa valeur
1383 if (nb_coques>0)
1384 {
1385 if (degre==1) of1 << "EGROUP,2,SHELL3,0,0,0,0,0,0,0,0;" << std::endl; // Formulation coques minces... SHELL3T pout �aisses
1386 if (degre==2) of1 << "EGROUP,2,SHELL6,0,0,0,0,0,0,0,0;" << std::endl;
1387 }
1388
1389 if (nb_poutres>0 || nb_coques>0 )
1390 {
1391 of1 << "EGROUP,3,BEAM3D,0,0,0,0,0,0,0,0;"<< std::endl; //Egroup des mini-poutres
1392 of1 << "RCONST,3,3,1,3," << "1, 1 , 1; " << std::endl;
1393 of1 << "EGROUP,4,RBAR;"<< std::endl; // EGroup des RBAR
1394 of1 << "EGROUP,5,BEAM3D,0,0,0,0,0,0,0,0;"<< std::endl; //Egroup des mini-poutres infiniment rigide
1395 of1 << "RCONST,5,5,1,3," << "0.01, 0.01 , 0.01; " << std::endl;
1396 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...)
1397 of1 << "RCONST,6,6,1,3," << "1e-16, 0.01 , 1e-16; " << std::endl;
1398 }
1399
1400 int RCset =7;
1401
1402 LISTE_MG_COQUE::iterator ico;
1403 MG_COQUE *mgcoque=mg_geometrie->get_premier_coque(ico);
1404 while (mgcoque)
1405 {
1406 int nummatac=mgcoque->get_num_materiau();
1407 if ((nummatac!=nummat)&&(nummatac!=-1)) // si c'est = 0 alors on place le dernier mat�iau choisi.
1408 {
1409 nummat=nummatac;
1410 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
1411 }
1412
1413 for (int numcoquille=0;numcoquille<mgcoque->get_nb_mg_coquille();numcoquille++)
1414 {
1415 MG_COQUILLE* mgcoquille = mgcoque->get_mg_coquille(numcoquille);
1416 for (int cf = 0; cf<mgcoquille->get_nb_mg_coface();cf++)
1417 {
1418 MG_COFACE* mgcoface = mgcoquille->get_mg_coface(cf);
1419 MG_FACE* mgface = mgcoface->get_face();
1420
1421 double epaisseur=-1;
1422 for (int k=0;k<mgface->get_nb_ccf();k++) // aller chercher l'�aisseur de la coque
1423 {
1424 char nomCCF[3];
1425 mgface->get_type_ccf(k,nomCCF);
1426 if (strcmp(nomCCF,"EP")==0)
1427 epaisseur = mgface-> get_valeur_ccf(k);
1428 }
1429 of1 << "ACTSET,EG,2;"<< std::endl;
1430 of1 << "RCONST,2,"<< ++RCset << ",1,1," << epaisseur << ";" << std::endl; // le real constant, s'active automatiquement
1431
1432 TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> * lien_maillage = mgface->get_lien_fem_maillage();
1433 int nbelem=lien_maillage->get_nb();
1434 for (int i=0;i<nbelem;i++)
1435 {
1436 FEM_ELEMENT2* femtriangle=(FEM_ELEMENT2*)lien_maillage->get(i);
1437 if (!contient(femtriangle)) continue;
1438 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;
1439 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;
1440 // dans les noeuds des sommets sont, 1, 2 et 3. les noeuds sur les segments sont 4 5 et 6
1441
1442 long nbc;
1443 MG_TRIANGLE* mgtri=(MG_TRIANGLE*)femtriangle->get_mg_element_maillage();
1444 char nom[3];
1445
1446 nbc = mgtri->get_segment1()->get_lien_topologie()->get_nb_ccf();
1447 for (int z =0 ; z< nbc; z++) // le premier segment
1448 { // il y a au moins une CCF "EP" qu'il faut ignorer
1449 mgtri->get_segment1()->get_lien_topologie()->get_type_ccf(z,nom); // ->get_triangle3()->get_lien_topologie()->get_type_ccf(k,nom);
1450 if (strcmp(nom,"EP")==0) continue;
1451 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;
1452 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;
1453 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;
1454 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;
1455 }
1456 nbc = mgtri->get_segment2()->get_lien_topologie()->get_nb_ccf();
1457 for (int z =0 ; z< nbc; z++)
1458 {
1459 mgtri->get_segment2()->get_lien_topologie()->get_type_ccf(z,nom);
1460 if (strcmp(nom,"EP")==0) continue;
1461 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;
1462 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;
1463 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;
1464 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;
1465 }
1466 nbc = mgtri->get_segment3()->get_lien_topologie()->get_nb_ccf();
1467 for (int z =0 ; z< nbc; z++)
1468 {
1469 mgtri->get_segment3()->get_lien_topologie()->get_type_ccf(z,nom);
1470 if (strcmp(nom,"EP")==0) continue;
1471 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;
1472 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;
1473 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;
1474 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;
1475 }
1476
1477
1478 nbc = mgtri->get_lien_topologie()->get_nb_ccf(); // et pour la face elle-m�e
1479 for (int z =0 ; z< nbc; z++)
1480 {
1481 mgtri->get_lien_topologie()->get_type_ccf(z,nom);
1482 if (strcmp(nom,"EP")==0) continue;
1483 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;
1484 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;
1485 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;
1486 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;
1487 }
1488
1489 }
1490
1491 } // next face
1492 } // next coquille
1493 mgcoque = mg_geometrie->get_suivant_coque(ico);
1494 }// next coque
1495
1496
1497 // **************************
1498 // maintenant les poutres
1499 // **************************
1500
1501
1502
1503 //for (int i = 0 ; i<nb_poutres;i++)
1504 LISTE_MG_POUTRE::iterator it_po;
1505 MG_POUTRE* mgpoutre = mg_geometrie->get_premier_poutre(it_po);
1506 while (mgpoutre)
1507 {
1508 //MG_POUTRE* mgpoutre = mg_geometrie->get_mg_poutre(i);
1509 int nummatac=mgpoutre->get_num_materiau();
1510 if ((nummatac!=nummat)&&(nummatac!=-1))
1511 {
1512 nummat=nummatac;
1513 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
1514 }
1515
1516 for (int j = 0;j<mgpoutre->get_nb_mg_boucle();j++)
1517 {
1518 MG_BOUCLE* mgboucle = mgpoutre->get_mg_boucle(j);
1519
1520 for (int k = 0 ; k<mgboucle->get_nb_mg_coarete();k++)
1521 {
1522 MG_COARETE* mgcoarete = mgboucle->get_mg_coarete(k);
1523 MG_ARETE* mgarete = mgcoarete->get_arete();
1524
1525 double IXX = 0;
1526 double IYY = 0;
1527 double Aire = 0;
1528 double x3 = 0;
1529 double y3 = 0;
1530 double z3 = 0;
1531
1532 for (int k=0;k<mgarete->get_nb_ccf();k++)
1533 {
1534 char nomCCF[3];
1535 mgarete->get_type_ccf(k,nomCCF);
1536 if (strcmp(nomCCF,"As")==0)
1537 Aire = mgarete->get_valeur_ccf(k);
1538 if (strcmp(nomCCF,"IX")==0)
1539 IXX = mgarete->get_valeur_ccf(k);
1540 if (strcmp(nomCCF,"IY")==0)
1541 IYY = mgarete->get_valeur_ccf(k);
1542 if (strcmp(nomCCF,"NX")==0)
1543 x3 = mgarete->get_valeur_ccf(k);
1544 if (strcmp(nomCCF, "NY")==0)
1545 y3 = mgarete->get_valeur_ccf(k);
1546 if (strcmp(nomCCF, "NZ")==0)
1547 z3 = mgarete->get_valeur_ccf(k);
1548 }
1549
1550 if ( Aire==-7) // -7 est un flag pour diff�rencier les mini-poutres...
1551 { // mini-poutre
1552 of1 << "Actset,EG,5;"<<std::endl;
1553 of1 << "Actset,RC,5;"<<std::endl;
1554 of1 << "C* MINI - POUTRE" << std:: endl;
1555
1556 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
1557 {
1558 FEM_ELEMENT1* femseg = (FEM_ELEMENT1*)mgarete->get_lien_fem_maillage()->get(t);
1559 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<femseg->get_fem_noeud(0)->get_numero()<< ","<< femseg->get_fem_noeud(1)->get_numero()<<";" << std::endl;
1560 } // next segment
1561 }
1562 else
1563 { // poutre normale
1564 of1 << "Actset,EG,3;"<<std::endl;
1565 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
1566 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
1567
1568 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
1569 {
1570 FEM_ELEMENT1* femseg = (FEM_ELEMENT1*)mgarete->get_lien_fem_maillage()->get(t);
1571 if (!contient(femseg)) continue;
1572 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;
1573
1574 for (int k=0;k<mgarete->get_nb_ccf();k++)
1575 {
1576 char nom[3];
1577 mgarete->get_type_ccf(k,nom);
1578 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;
1579 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;
1580 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;
1581 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!!!
1582 }
1583 } // next segment
1584 }
1585
1586
1587 } // next arete
1588 } // next boucle
1589 mgpoutre=mg_geometrie->get_suivant_poutre(it_po);
1590 } // next poutre
1591
1592 // Cas sp�cial, une ar�te normale est flagg�e comme une mini-poutre (dans coupecot�)
1593 LISTE_MG_ARETE::iterator ita;
1594 MG_ARETE* mgarete = mg_geometrie->get_premier_arete(ita);
1595
1596 while (mgarete)
1597 {
1598 double Aire = 0;
1599
1600 for (int k=0;k<mgarete->get_nb_ccf();k++)
1601 {
1602 char nomCCF[3];
1603 mgarete->get_type_ccf(k,nomCCF);
1604 if (strcmp(nomCCF,"As")==0)
1605 Aire = mgarete->get_valeur_ccf(k);
1606 }
1607
1608 if ( Aire==-7) // -7 est un flag pour diff�rencier les mini-poutres... non orient�e
1609 { // mini-poutre
1610 of1 << "Actset,EG,5;"<<std::endl;
1611 of1 << "Actset,RC,5;"<<std::endl;
1612 of1 << "C* MINI - POUTRE" << std:: endl;
1613
1614 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
1615 {
1616 FEM_ELEMENT1* femseg = (FEM_ELEMENT1*)mgarete->get_lien_fem_maillage()->get(t);
1617 if (!contient(femseg)) continue;
1618 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<femseg->get_fem_noeud(0)->get_numero()<< ","<< femseg->get_fem_noeud(1)->get_numero()<<";" << std::endl;
1619 }
1620 }
1621 mgarete=mg_geometrie->get_suivant_arete(ita);
1622 }
1623
1624
1625
1626 //************************************************************
1627 // Pour mettre des mini-poutres sur les faces concern�es *****
1628 //*************************************************************
1629 // identifications des faces du qui sont des faces internes.
1630
1631 LISTE_MG_FACE::iterator itf;
1632 MG_FACE* mgface = mg_geometrie->get_premier_face(itf);
1633
1634
1635 while (mgface)
1636 {
1637 for (int k=0;k<mgface->get_nb_ccf();k++)
1638 {
1639 char nomCCF[3];
1640 mgface->get_type_ccf(k,nomCCF);
1641
1642 if (strcmp(nomCCF,"FI")==0)
1643 {
1644 TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> * lien_fem_maillage = mgface->get_lien_fem_maillage();
1645 FEM_ELEMENT_MAILLAGE* element;
1646
1647 //si on a une faceinterne de poutre alors on a une CCF "Po" = 0
1648 // sinon la CCF Po est �gale � 1 et on a une coque
1649 int Poutre = -1;
1650
1651 for (int z=0;z<mgface->get_nb_ccf();z++)
1652 {
1653 char nomCCF2[3];
1654 mgface->get_type_ccf(z,nomCCF);
1655 if (strcmp(nomCCF,"Po")==0)
1656 {
1657 Poutre = mgface->get_valeur_ccf(z);
1658 }
1659 }
1660
1661
1662 if (Poutre ==0)
1663 { // mini-poutres pour des poutres
1664 of1 << "ACTSET,EG,5; C* Face avec mini-poutres de POUTRE"<<std::endl;
1665 of1 << "ACTSET,RC,5;"<<std::endl;
1666 for (int i = 0 ; i< lien_fem_maillage->get_nb();i++)
1667 {
1668 FEM_ELEMENT2* femtriangle=(FEM_ELEMENT2*)lien_fem_maillage->get(i) ;
1669
1670 FEM_NOEUD* nd0 =femtriangle->get_fem_noeud(0);
1671 FEM_NOEUD* nd1 =femtriangle->get_fem_noeud(1);
1672 FEM_NOEUD* nd2= femtriangle->get_fem_noeud(2);
1673
1674 // 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 ;
1675 //si on veut orienter les propri�t�s,
1676 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd0->get_numero()<< "," << nd1->get_numero()<< ";" << std::endl;
1677 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd1->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
1678 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd0->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
1679 }
1680 }
1681 else if (Poutre==1)
1682 { // mini-poutres pour des coques
1683 of1 << "ACTSET,EG,6; C* Face avec mini-poutres de COQUE"<<std::endl;
1684 of1 << "ACTSET,RC,6;"<<std::endl;
1685 for (int i = 0 ; i< lien_fem_maillage->get_nb();i++)
1686 {
1687 FEM_ELEMENT2* femtriangle=(FEM_ELEMENT2*)lien_fem_maillage->get(i) ;
1688
1689 FEM_NOEUD* nd0 =femtriangle->get_fem_noeud(0);
1690 FEM_NOEUD* nd1 =femtriangle->get_fem_noeud(1);
1691 FEM_NOEUD* nd2= femtriangle->get_fem_noeud(2);
1692
1693 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd0->get_numero()<< "," << nd1->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
1694 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd1->get_numero()<< "," << nd2->get_numero()<< "," << nd0->get_numero()<< ";" << std::endl;
1695 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd0->get_numero()<< "," << nd2->get_numero()<< "," << nd1->get_numero()<< ";" << std::endl;
1696 }
1697 }
1698 } // end if FI
1699 } // next CCF
1700 mgface= mg_geometrie->get_suivant_face(itf);
1701 } // end while face
1702
1703
1704
1705 //of1<< "NMERGE;" <<std::endl;
1706 //of1<< "NCOMPRESS;" <<std::endl;
1707
1708 //of1<< "SETEPLOT,1,1,0,0;"<<std::endl;
1709 //of1<< "ACTECLR,1,RC,1;"<<std::endl;
1710
1711 of1<< "EPLOT;"<<std::endl;
1712 of1<< "PSCALE;"<<std::endl;
1713 //lst_FaceInternes.vide();
1714
1715 }
1716
1717
1718 double FEM_MAILLAGE::calcul_coef(void)
1719 {
1720 if (!deforme) return 0.;
1721 LISTE_FEM_NOEUD::iterator it;
1722 double max=0.,dmax=0.;
1723 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1724 {
1725 double x=noeud->get_x();
1726 double y=noeud->get_y();
1727 double z=noeud->get_z();
1728 double dx=noeud->get_dx();
1729 double dy=noeud->get_dy();
1730 double dz=noeud->get_dz();
1731 if (fabs(x)>max) max=fabs(x);
1732 if (fabs(y)>max) max=fabs(y);
1733 if (fabs(z)>max) max=fabs(z);
1734 if (fabs(dx)>dmax) dmax=fabs(dx);
1735 if (fabs(dy)>dmax) dmax=fabs(dy);
1736 if (fabs(dz)>dmax) dmax=fabs(dz);
1737 }
1738 if (dmax<1e-10) return 0;
1739 double coef=0.1*max/dmax;
1740 return coef;
1741 }
1742
1743
1744
1745
1746 void FEM_MAILLAGE::calcul_deforme(FEM_SOLUTION* solx,int numx,FEM_SOLUTION* soly,int numy,FEM_SOLUTION* solz,int numz)
1747 {
1748 LISTE_FEM_NOEUD::iterator it;
1749 solx->active_solution(numx);
1750 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1751
1752 noeud->change_dx(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
1753
1754 soly->active_solution(numy);
1755 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1756
1757 noeud->change_dy(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
1758
1759 solz->active_solution(numz);
1760 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1761
1762 noeud->change_dz(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
1763
1764 deforme=1;
1765 }
1766
1767
1768 int FEM_MAILLAGE::existe_deforme(void)
1769 {
1770 return deforme;
1771 }
1772
1773 void FEM_MAILLAGE::active_deforme(void)
1774 {
1775 deforme=1;
1776 }
1777
1778 void FEM_MAILLAGE::desactive_deforme(void)
1779 {
1780 deforme=0;
1781 }
1782
1783 int FEM_MAILLAGE::existe_reaction(void)
1784 {
1785 return reaction;
1786 }
1787
1788 void FEM_MAILLAGE::active_reaction(void)
1789 {
1790 reaction=1;
1791 }
1792
1793 void FEM_MAILLAGE::desactive_reaction(void)
1794 {
1795 reaction=0;
1796 }
1797
1798 void FEM_MAILLAGE::calcul_somme_reaction(double &rx,double &ry,double &rz)
1799 {
1800 rx=0.;
1801 ry=0.;
1802 rz=0.;
1803 LISTE_FEM_NOEUD::iterator it;
1804 for (FEM_NOEUD* no=get_premier_noeud(it);no!=NULL;no=get_suivant_noeud(it))
1805 {
1806 rx=rx+no->get_rx();
1807 ry=ry+no->get_ry();
1808 rz=rz+no->get_rz();
1809 }
1810 }
1811
1812
1813
1814
1815
1816 std::ostream& operator << (std::ostream& o,FEM_MAILLAGE& maillage)
1817 {
1818 maillage.enregistrer(o,VERSIONFICHIER);
1819 return o;
1820 }
1821
1822
1823 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)
1824 {
1825 nb_noeud=get_nb_fem_noeud();
1826 LISTE_FEM_ELEMENT1::iterator it1;
1827 for (FEM_ELEMENT1* ele=get_premier_element1(it1);ele!=NULL;ele=get_suivant_element1(it1))
1828 {
1829 int nb=ele->get_nb_fem_noeud();
1830 if (nb==2) nb_seg2++;
1831 if (nb==3) nb_seg3++;
1832 }
1833 LISTE_FEM_ELEMENT2::iterator it2;
1834 for (FEM_ELEMENT2* ele=get_premier_element2(it2);ele!=NULL;ele=get_suivant_element2(it2))
1835 {
1836 int nb=ele->get_nb_fem_noeud();
1837 if (nb==3) nb_tri3++;
1838 if (nb==4) nb_quad4++;
1839 if (nb==6) nb_tri6++;
1840 if (nb==8) nb_quad8++;
1841 }
1842 LISTE_FEM_ELEMENT3::iterator it3;
1843 for (FEM_ELEMENT3* ele=get_premier_element3(it3);ele!=NULL;ele=get_suivant_element3(it3))
1844 {
1845 int nb=ele->get_nb_fem_noeud();
1846 if (nb==4) nb_tet4++;
1847 if (nb==8) nb_hex8++;
1848 if (nb==10) nb_tet10++;
1849 if (nb==20) nb_hex20++;
1850 }
1851 }
1852
1853
1854 void FEM_MAILLAGE::change_param_structure(BOITE_3D btmp,int nxtmp,int nytmp,int nztmp)
1855 {
1856 boite_englobante=btmp;
1857 nx=nxtmp;
1858 ny=nytmp;
1859 nz=nztmp;
1860 est_structure=true;
1861 }
1862
1863
1864 bool FEM_MAILLAGE::get_param_structure(BOITE_3D &btmp,int &nxtmp,int &nytmp,int &nztmp)
1865 {
1866 if (est_structure==true)
1867 {
1868 btmp=boite_englobante;
1869 nxtmp=nx;
1870 nytmp=ny;
1871 nztmp=nz;
1872 return true;
1873 }
1874 return false;
1875 }
1876
1877 bool FEM_MAILLAGE::get_est_structure(void)
1878 {
1879 return est_structure;
1880 }
1881