ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/fichier/src/mg_file.cpp
Revision: 133
Committed: Thu Jul 31 19:32:22 2008 UTC (16 years, 9 months ago) by sablaoui
Original Path: magic/lib/fichier/fichier/src/mg_file.cpp
File size: 55671 byte(s)
Log Message:
ajout de opencascade comme nouveau brep 

File Contents

# User Rev Content
1 foucault 27 //------------------------------------------------------------
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_file.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 �11H22
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25     #include "gestionversion.h"
26    
27     #pragma hdrstop
28    
29     #include "mg_file.h"
30     #include "pars_argument.h"
31     #include "parse.h"
32 sablaoui 133 #ifdef BREP_STEP
33 foucault 27 #include "step_surface.h"
34     #include "step_courbe.h"
35     #include "step_point.h"
36 sablaoui 133 #endif
37     #ifdef BREP_SAT
38 foucault 27 #include "acis_surface.h"
39     #include "acis_courbe.h"
40     #include "acis_point.h"
41 sablaoui 133 #endif
42     #ifdef BREP_SLD
43 foucault 27 #include "sld_point.h"
44     #include "sld_courbe.h"
45     #include "sld_surface.h"
46     #include "sld_fonction.h"
47 sablaoui 133 #endif
48 foucault 27 #include "lc_point.h"
49 sablaoui 133
50 souaissa 114 //OCC
51 sablaoui 133 #ifdef BREP_OCC
52 souaissa 114 #include "OCC_Surface.h"
53     #include "OCC_POINT.h"
54     #include "OCC_Courbe.h"
55     #include "OCC_FONCTION1.h"
56 sablaoui 133 #include "TopoDS_Shape.hxx"
57     #include "TopoDS.hxx"
58     #endif
59 foucault 27 //---------------------------------------------------------------------------
60     // CAD4FE Headers
61 sablaoui 133 #ifdef WINDOWS_VERSION
62 foucault 27 #include "CAD4FE_MCEdge.h"
63     #include "CAD4FE_MCFace.h"
64     #include "CAD4FE_MCVertex.h"
65     #include "CAD4FE_PolySurface.h"
66     #include "CAD4FE_PolyCurve.h"
67     #include "CAD4FE_MCNode.h"
68     #include "CAD4FE_MCSegment.h"
69     #include "CAD4FE_MCTriangle.h"
70     #include "CAD4FE_m3d_MCTriangle.h"
71 sablaoui 133 #endif
72 foucault 27 //---------------------------------------------------------------------------
73    
74    
75     //---------------------------------------------------------------------------
76     #pragma package(smart_init)
77    
78     MG_FILE::MG_FILE():MG_GESTIONNAIRE()
79     {
80     }
81    
82     MG_FILE::MG_FILE(char* chemin):MG_GESTIONNAIRE()
83     {
84     code_de_lecture=lire(chemin);
85     }
86    
87     MG_FILE::~MG_FILE()
88     {
89     }
90    
91     int MG_FILE::get_code_de_lecture(void)
92     {
93     return code_de_lecture;
94     }
95    
96     long MG_FILE::cid(std::string str)
97     {
98     const char *p=str.c_str();
99     if (*p=='$') return atol(p+1);
100     return -1;
101     }
102    
103     int MG_FILE::lire(char* chemin)
104     {
105     FILE *in;
106     char ligne[3000];
107     in=fopen(chemin,"rt");
108     if (in==NULL) return 0;
109     PARS_ARGUMENT param[100];
110     PARSE parse;
111    
112     MG_GEOMETRIE *mggeo;
113     std::multimap<CAD4FE::MCVertex*, unsigned long> mapMergedRefVertices;
114     bool updatedMergedRefVertices = false;
115 souaissa 114
116 foucault 27 do
117     {
118     int ierr;
119     std::string ligne=parse.lire(in,';',&ierr);
120     parse.decode(ligne.c_str(),"@;",param);
121     const char *chaine=param[0].argument[0].c_str();
122     if ((chaine[0]=='/') && (chaine[1]=='/'))
123     {
124     if ((chaine[2]=='*')&&(chaine[3]=='i'))
125     {
126     unsigned long id;
127     sscanf(chaine,"//*i:%lu;",&id);
128     entiteidmax=id;
129     }
130     }
131     else if (param[0].argument[0]!="FIN")
132     {
133     parse.decode(ligne.c_str(),"%@=@(@);",param);
134     std::string entite=param[1].argument[0];
135     long id=atol(param[0].argument[0].c_str());
136     std::string data=param[2].argument[0] ;
137     MG_MAILLAGE *mgmai;
138     FEM_MAILLAGE *femmai;
139     if (entite=="GEOMETRIE")
140     {
141     parse.decode(data.c_str(),"@,@,@,@",param+2);
142     double unite=atof(param[2].argument[0].c_str());
143     std::string typegeo=param[3].argument[0];
144     std::string chemin=param[4].argument[0];
145     #ifdef BREP_STEP
146     if (typegeo=="STEP")
147     {
148     fichstep.change_nom((char *)chemin.c_str());
149     int code=fichstep.lire();
150     if (code==0) return 0;
151     mggeo=new MG_GEOMETRIE("STEP",id,fichstep.get_nom(),unite);
152     ajouter_mg_geometrie(mggeo);
153     }
154     #endif
155     #ifdef BREP_SAT
156     if (typegeo=="ACIS")
157     {
158     fichsat.change_nom((char *)chemin.c_str());
159     int code=fichsat.lire();
160     if (code==0) return 0;
161     mggeo=new MG_GEOMETRIE("ACIS",id,fichsat.get_nom(),unite);
162     ajouter_mg_geometrie(mggeo);
163     }
164     #endif
165     #ifdef BREP_SLD
166     if (typegeo=="SLD")
167     {
168     fonction->Connection();
169     fonction->OuvrirFichier((char *)chemin.c_str() );
170     mggeo=new MG_GEOMETRIE("SLD",id,chemin.c_str(),unite);
171     ajouter_mg_geometrie(mggeo);
172     ouvertsld=1;
173     }
174     #endif
175 souaissa 114
176 sablaoui 133 #ifdef BREP_OCC
177 souaissa 114 if (typegeo=="OCC")
178     {
179 sablaoui 133 fonction1->OuvrirFichierStep((char *)chemin.c_str() );
180     mggeo=new MG_GEOMETRIE("OCC",id,chemin.c_str(),unite);
181 souaissa 114 ajouter_mg_geometrie(mggeo);
182     }
183     #endif
184    
185 foucault 27 std::string nommat="";
186     if (param[5].argument[0]!="")
187 souaissa 114 nommat=param[5].argument[0];
188     mggeo->change_gest_materiau((char*)nommat.c_str());
189 foucault 27 }
190     if (entite=="VOLUME")
191     {
192     parse.decode(data.c_str(),"@,@,@,@,(&)",param+2);
193     MG_VOLUME* mgvol=new MG_VOLUME(param[2].argument[0],id);
194     mggeo->ajouter_mg_volume(mgvol);
195     int nummat=atoi((char*)param[4].argument[0].c_str());
196     mgvol->change_num_materiau(nummat);
197     int nb=atoi(param[5].argument[0].c_str());
198     if (nb!=0)
199     {
200     for (int i=0;i<nb;i++)
201     {
202     parse.decode(param[6].argument[i].c_str(),"(@,@)",param+7);
203     char nom[3];
204     double val;
205     strcpy(nom,param[7].argument[0].c_str());
206     val=atof(param[8].argument[0].c_str());
207     mgvol->ajouter_ccf(nom,val);
208     }
209     }
210     }
211     if (entite=="COQUE")
212     {
213     parse.decode(data.c_str(),"@,@,@,@,(&)",param+2);
214     MG_COQUE* mgcoq=new MG_COQUE(param[2].argument[0],id);
215     mggeo->ajouter_mg_coque(mgcoq);
216     int nummat=atoi((char*)param[4].argument[0].c_str());
217     mgcoq->change_num_materiau(nummat);
218     int nb=atoi(param[5].argument[0].c_str());
219     if (nb!=0)
220     {
221     for (int i=0;i<nb;i++)
222     {
223     parse.decode(param[6].argument[i].c_str(),"(@,@)",param+7);
224     char nom[3];
225     double val;
226     strcpy(nom,param[7].argument[0].c_str());
227     val=atof(param[8].argument[0].c_str());
228     mgcoq->ajouter_ccf(nom,val);
229     }
230     }
231     }
232     if (entite=="POUTRE")
233     {
234     parse.decode(data.c_str(),"@,@,@,@,(&)",param+2);
235     MG_POUTRE* mgpoutre=new MG_POUTRE(param[2].argument[0],id);
236     mggeo->ajouter_mg_poutre(mgpoutre);
237     int nummat=atoi((char*)param[4].argument[0].c_str());
238     mgpoutre->change_num_materiau(nummat);
239     int nb=atoi(param[5].argument[0].c_str());
240     if (nb!=0)
241     {
242     for (int i=0;i<nb;i++)
243     {
244     parse.decode(param[6].argument[i].c_str(),"(@,@)",param+7);
245     char nom[3];
246     double val;
247     strcpy(nom,param[7].argument[0].c_str());
248     val=atof(param[8].argument[0].c_str());
249     mgpoutre->ajouter_ccf(nom,val);
250     }
251     }
252     }
253     if (entite=="COQUILLE")
254     {
255     parse.decode(data.c_str(),"@,@",param+2);
256     long ident=cid(param[2].argument[0]);
257     MG_VOLUME* mgvol=mggeo->get_mg_volumeid(ident);
258     MG_COQUE* mgcoq=mggeo->get_mg_coqueid(ident);
259     if (mgvol!=NULL)
260     {
261     MG_COQUILLE* mgcoq=new MG_COQUILLE(id,mgvol);
262     mggeo->ajouter_mg_coquille(mgcoq,mgvol);
263     }
264     if (mgcoq!=NULL)
265     {
266     MG_COQUILLE* mgcoquille=new MG_COQUILLE(id,mgcoq);
267     mggeo->ajouter_mg_coquille(mgcoquille,mgcoq);
268     }
269    
270     }
271     #ifdef BREP_STEP
272     if (entite=="SURFACE_STEP")
273     {
274     parse.decode(data.c_str(),"@",param+2);
275     long idstepsuf=atol(param[2].argument[0].c_str());
276     ST_SURFACE *stsurf=fichstep.lst_surface.getid(idstepsuf);
277     STEP_SURFACE* stepsurf=new STEP_SURFACE(id,stsurf);
278     mggeo->ajouter_mg_surface(stepsurf);
279     }
280     if (entite=="COURBE_STEP")
281     {
282     parse.decode(data.c_str(),"@",param+2);
283     long idstepcur=atol(param[2].argument[0].c_str());
284     ST_COURBE *stcur=fichstep.lst_courbe.getid(idstepcur);
285     STEP_COURBE* stepcur=new STEP_COURBE(id,stcur);
286     mggeo->ajouter_mg_courbe(stepcur);
287     }
288    
289     if (entite=="POINT_STEP")
290     {
291     parse.decode(data.c_str(),"@",param+2);
292     long idsteppt=atol(param[2].argument[0].c_str());
293     ST_POINT *stpt=fichstep.lst_point.getid(idsteppt);
294     STEP_POINT* steppt=new STEP_POINT(id,stpt);
295     mggeo->ajouter_mg_point(steppt);
296     }
297    
298     #endif
299     #ifdef BREP_SAT
300     if (entite=="SURFACE_SAT")
301     {
302     parse.decode(data.c_str(),"@",param+2);
303     long idsatsuf=atol(param[2].argument[0].c_str());
304     SAT_SURFACE *satsurf=fichsat.lst_surface.getid(idsatsuf);
305     ACIS_SURFACE* acissurf=new ACIS_SURFACE(id,satsurf);
306     mggeo->ajouter_mg_surface(acissurf);
307     }
308     if (entite=="COURBE_SAT")
309     {
310     parse.decode(data.c_str(),"@",param+2);
311     long idsatcur=atol(param[2].argument[0].c_str());
312     SAT_COURBE *satcur=fichsat.lst_courbe.getid(idsatcur);
313     ACIS_COURBE* aciscur=new ACIS_COURBE(id,satcur);
314     mggeo->ajouter_mg_courbe(aciscur);
315     }
316    
317     if (entite=="POINT_SAT")
318     {
319     parse.decode(data.c_str(),"@",param+2);
320     long idsatpt=atol(param[2].argument[0].c_str());
321     SAT_POINT *satpt=fichsat.lst_point.getid(idsatpt);
322     ACIS_POINT* acispt=new ACIS_POINT(id,satpt);
323     mggeo->ajouter_mg_point(acispt);
324     }
325    
326     #endif
327     #ifdef BREP_SLD
328     if (entite=="SURFACE_SLD")
329     {
330     parse.decode(data.c_str(),"@",param+2);
331     CComPtr<IFace2> swface;
332     char* idsld=(char*)param[2].argument[0].c_str();
333     SLD_SURFACE* sldsurf=new SLD_SURFACE(id,idsld,*fonction);
334     mggeo->ajouter_mg_surface(sldsurf);
335     }
336     if (entite=="COURBE_SLD")
337     {
338     parse.decode(data.c_str(),"@",param+2);
339     CComPtr<IEdge> swedge;
340     char* idsld=(char*)param[2].argument[0].c_str();
341     SLD_COURBE* sldcrb=new SLD_COURBE(id,idsld,*fonction);
342     mggeo->ajouter_mg_courbe(sldcrb);
343     }
344    
345     if (entite=="POINT_SLD")
346     {
347     parse.decode(data.c_str(),"@",param+2);
348     CComPtr<IVertex> swvertex;
349     char* idsld=(char*)param[2].argument[0].c_str();
350     SLD_POINT* sldpoint=new SLD_POINT(id,idsld,*fonction);
351     mggeo->ajouter_mg_point(sldpoint);
352     }
353    
354     #endif
355 souaissa 114
356     #ifdef BREP_OCC
357     if (entite=="SURFACE_OCC")
358     {
359     parse.decode(data.c_str(),"@",param+2);
360 sablaoui 133 long idocc=atol(param[2].argument[0].c_str());
361     const TopoDS_Shape& occshape=fonction1->GetShape(idocc);
362     TopoDS_Face occface=TopoDS::Face(occshape);
363     OCC_SURFACE* occsurf=new OCC_SURFACE(id,occface, *fonction1);
364 souaissa 114 mggeo->ajouter_mg_surface(occsurf);
365     }
366     if (entite=="COURBE_OCC")
367     {
368     parse.decode(data.c_str(),"@",param+2);
369 sablaoui 133 long idocc=atol(param[2].argument[0].c_str());
370     const TopoDS_Shape& occshape=fonction1->GetShape(idocc);
371     TopoDS_Edge occedge=TopoDS::Edge(occshape);
372     OCC_COURBE* occcrb=new OCC_COURBE(id,occedge, *fonction1);
373 souaissa 114 mggeo->ajouter_mg_courbe(occcrb);
374     }
375     if (entite=="POINT_OCC")
376     {
377     parse.decode(data.c_str(),"@",param+2);
378 sablaoui 133 long idocc=atol(param[2].argument[0].c_str());
379     const TopoDS_Shape& occshape=fonction1->GetShape(idocc);
380     TopoDS_Vertex occvertex=TopoDS::Vertex(occshape);
381     OCC_POINT* occpoint=new OCC_POINT(id,occvertex, *fonction1);
382 souaissa 114 mggeo->ajouter_mg_point(occpoint);
383     }
384     #endif
385 foucault 27 if (entite=="CAD4FE_POLYCURVE")
386     {
387 souaissa 114 CAD4FE::PolyCurve * polycurve = NULL;
388     parse.decode(data.c_str(),"@,(&)",param+2);
389     int nb = atoi(param[2].argument[0].c_str());
390    
391     if (nb == 0)
392     {
393     printf("PolyCurve %d is formed with reference vertex : ", id);
394 sablaoui 133 parse.decode(param[3].argument[0].c_str(),"@",param+4);
395 souaissa 114 int idRefVertex;
396     idRefVertex=cid(param[4].argument[0].c_str());
397     printf("%d ;\n ", idRefVertex);
398     MG_SOMMET * refVertex = mggeo->get_mg_sommetid(idRefVertex);
399     polycurve = new CAD4FE::PolyCurve(refVertex);
400     }
401     else
402 sablaoui 133 {
403 souaissa 114 printf("PolyCurve %d is formed with reference edges : ", id);
404 foucault 27 polycurve = new CAD4FE::PolyCurve;
405     for (int i=0;i<nb;i++)
406     {
407     parse.decode(param[3].argument[i].c_str(),"@",param+4);
408     int idRefEdge;
409     idRefEdge=cid(param[4].argument[0].c_str());
410     printf("%d ; ", idRefEdge);
411     MG_ARETE * refEdge = mggeo->get_mg_areteid(idRefEdge);
412 souaissa 114 CAD4FE::PolyCurve tmpPC(refEdge);
413 foucault 27 polycurve->Merge(tmpPC);
414     }
415     printf("\n");
416 souaissa 114 }
417    
418 foucault 27 polycurve->change_id(id);
419     mggeo->ajouter_mg_courbe(polycurve);
420     }
421    
422    
423     if (entite=="CAD4FE_POLYSURFACE")
424     {
425     CAD4FE::PolySurface * polysurface = new CAD4FE::PolySurface;
426     polysurface->change_id(id);
427     mggeo->ajouter_mg_surface(polysurface);
428    
429     parse.decode(data.c_str(),"@,(&)",param+2);
430    
431     int nb = atoi(param[2].argument[0].c_str());
432     printf("PolySurface %d is formed with reference faces : ", id);
433     for (int i=0;i<nb;i++)
434     {
435     parse.decode(param[3].argument[i].c_str(),"@",param+4);
436     int idRefFace;
437     idRefFace=cid(param[4].argument[0].c_str());
438     printf("%d ; ", idRefFace);
439    
440     MG_FACE * refFace = mggeo->get_mg_faceid(idRefFace);
441     CAD4FE::PolySurface tmpSF(refFace);
442     polysurface->Merge(tmpSF);
443     }
444    
445     printf("\n");
446     }
447     if (entite=="CAD4FE_MCEDGE")
448     {
449     parse.decode(data.c_str(),"@,@,@,@,@,@,(&)",param+2);
450    
451     std::string idOriginal = param[2].argument[0];
452     long idPolyCurve=cid(param[3].argument[0]);
453     CAD4FE::PolyCurve * polycurve = (CAD4FE::PolyCurve *) mggeo->get_mg_courbeid(idPolyCurve);
454    
455     // sense is not used because a MCEdge always has
456     // a sense = 1 !
457     // (because polycurve domain is equal to mcEdge domain)
458     CAD4FE::MCEdge * mcEdge = new CAD4FE::MCEdge(idOriginal, polycurve);
459     mcEdge->change_id(id);
460     mggeo->ajouter_mg_arete(mcEdge);
461    
462     int nb=atoi(param[7].argument[0].c_str());
463     if (nb!=0)
464     {
465     for (int i=0;i<nb;i++)
466     {
467     parse.decode(param[8].argument[i].c_str(),"(@,@)",param+9);
468     char nom[3];
469     double val;
470     strcpy(nom,param[9].argument[0].c_str());
471     val=atof(param[10].argument[0].c_str());
472     mcEdge->ajouter_ccf(nom,val);
473     }
474     }
475     }
476     if (entite=="CAD4FE_MCFACE")
477     {
478 foucault 64 parse.decode(data.c_str(),"@,@,@,@,@,(&)",param+2);
479 foucault 27
480     std::string idOriginal = param[2].argument[0];
481     long idPolySurface=cid(param[3].argument[0]);
482     CAD4FE::PolySurface * polysurface = (CAD4FE::PolySurface *) mggeo->get_mg_surfaceid(idPolySurface);
483    
484     CAD4FE::MCFace * mcFace = new CAD4FE::MCFace(idOriginal, polysurface);
485     mcFace->change_id(id);
486     mggeo->ajouter_mg_face(mcFace);
487    
488     int nb=atoi(param[6].argument[0].c_str());
489     if (nb!=0)
490     {
491     for (int i=0;i<nb;i++)
492     {
493     parse.decode(param[7].argument[i].c_str(),"(@,@)",param+8);
494     char nom[3];
495     double val;
496     strcpy(nom,param[8].argument[0].c_str());
497     val=atof(param[9].argument[0].c_str());
498     mcFace->ajouter_ccf(nom,val);
499     }
500     }
501     }
502     if (entite=="CAD4FE_MCVERTEX")
503     {
504     parse.decode(data.c_str(),"@,@,@,(&),@,(&)",param+2);
505     std::string idOriginal = param[2].argument[0];
506     long idsom=cid(param[3].argument[0]);
507     MG_SOMMET * mgsom = mggeo->get_mg_sommetid(idsom);
508     CAD4FE::MCVertex * mcVertex = new CAD4FE::MCVertex(mgsom);
509     mcVertex->change_id(id);
510     mggeo->ajouter_mg_sommet(mcVertex);
511     int nb_ref_vertex=atoi(param[4].argument[0].c_str());
512     if (nb_ref_vertex!=0)
513     {
514     for (int i=0;i<nb_ref_vertex;i++)
515     {
516     unsigned long idRefVertex=cid(param[5].argument[i]);
517     mcVertex->GetMergedRefVertices()[idRefVertex] = NULL;
518     mapMergedRefVertices.insert(std::make_pair(mcVertex,idRefVertex));
519     }
520     }
521     int nb_ccf=atoi(param[4+2].argument[0].c_str());
522     if (nb_ccf!=0)
523     {
524     for (int i=0;i<nb_ccf;i++)
525     {
526     parse.decode(param[5+2].argument[i].c_str(),"(@,@)",param+6+2);
527     char nom_ccf[3];
528     double val_ccf;
529     strcpy(nom_ccf,param[6+2].argument[0].c_str());
530     val_ccf=atof(param[7+2].argument[0].c_str());
531     mgsom->ajouter_ccf(nom_ccf,val_ccf);
532     }
533     }
534     }
535 souaissa 114
536 foucault 27 if (entite=="FACE")
537     {
538     parse.decode(data.c_str(),"@,@,(@),@,@,(&)",param+2);
539     long idsurf=cid(param[3].argument[0]);
540     int sens=atoi(param[5].argument[0].c_str());
541     MG_SURFACE* mgsurf=mggeo->get_mg_surfaceid(idsurf);
542     MG_FACE* mgface=new MG_FACE(param[2].argument[0],id,mgsurf,sens);
543     mggeo->ajouter_mg_face(mgface);
544     int nb=atoi(param[6].argument[0].c_str());
545     if (nb!=0)
546     {
547     for (int i=0;i<nb;i++)
548     {
549     parse.decode(param[7].argument[i].c_str(),"(@,@)",param+8);
550     char nom[3];
551     double val;
552     strcpy(nom,param[8].argument[0].c_str());
553     val=atof(param[9].argument[0].c_str());
554     mgface->ajouter_ccf(nom,val);
555     }
556     }
557     }
558     if (entite=="COFACE")
559     {
560     parse.decode(data.c_str(),"@,@,@",param+2);
561     long idface=cid(param[2].argument[0]);
562     long idcoq=cid(param[3].argument[0]);
563     int sens=atoi(param[4].argument[0].c_str());
564     MG_FACE* mgface=mggeo->get_mg_faceid(idface);
565     MG_COQUILLE* mgcoq=mggeo->get_mg_coquilleid(idcoq);
566     MG_COFACE* mgcoface=mggeo->ajouter_mg_coface(id,mgface,mgcoq,sens);
567     mgcoq->ajouter_mg_coface(mgcoface);
568     }
569     if (entite=="BOUCLE")
570     {
571     parse.decode(data.c_str(),"@,(@)",param+2);
572     long ident=cid(param[2].argument[0]);
573     MG_FACE* mgface=mggeo->get_mg_faceid(ident);
574     MG_POUTRE* mgpoutre=mggeo->get_mg_poutreid(ident);
575     if (mgface!=NULL)
576     {
577     MG_BOUCLE* mgbou=new MG_BOUCLE(id,mgface);
578     mggeo->ajouter_mg_boucle(mgbou,mgface);
579     }
580     if (mgpoutre!=NULL)
581     {
582     MG_BOUCLE* mgbou=new MG_BOUCLE(id,mgpoutre);
583     mggeo->ajouter_mg_boucle(mgbou,mgpoutre);
584     }
585     }
586     if (entite=="POINT")
587     {
588     parse.decode(data.c_str(),"@,@,@",param+2);
589     double xyz[3];
590     xyz[0]=atof(param[2].argument[0].c_str());
591     xyz[1]=atof(param[3].argument[0].c_str());
592     xyz[2]=atof(param[4].argument[0].c_str());
593     LC_POINT* point=new LC_POINT(id,xyz);
594     mggeo->ajouter_mg_point(point);
595     }
596     if (entite=="SOMMET")
597     {
598     parse.decode(data.c_str(),"@,@,@,(&)",param+2);
599     long idpoint=cid(param[3].argument[0]);
600     MG_POINT* mgpt=mggeo->get_mg_pointid(idpoint);
601     MG_SOMMET* mgsom=new MG_SOMMET(param[2].argument[0],id,mgpt);
602     mggeo->ajouter_mg_sommet(mgsom);
603     int nb=atoi(param[4].argument[0].c_str());
604     if (nb!=0)
605     {
606     for (int i=0;i<nb;i++)
607     {
608     parse.decode(param[5].argument[i].c_str(),"(@,@)",param+6);
609     char nom[3];
610     double val;
611     strcpy(nom,param[6].argument[0].c_str());
612     val=atof(param[7].argument[0].c_str());
613     mgsom->ajouter_ccf(nom,val);
614     }
615     }
616     }
617     if (entite=="ARETE")
618     {
619     parse.decode(data.c_str(),"@,@,@,@,@,@,(&)",param+2);
620     long idcur=cid(param[3].argument[0]);
621     int sens=atoi(param[6].argument[0].c_str());
622     MG_COURBE* mgcur=mggeo->get_mg_courbeid(idcur);
623     MG_ARETE* mgarete=new MG_ARETE(param[2].argument[0],id,mgcur,sens);
624     mggeo->ajouter_mg_arete(mgarete);
625     int nb=atoi(param[7].argument[0].c_str());
626     if (nb!=0)
627     {
628     for (int i=0;i<nb;i++)
629     {
630     parse.decode(param[8].argument[i].c_str(),"(@,@)",param+9);
631     char nom[3];
632     double val;
633     strcpy(nom,param[9].argument[0].c_str());
634     val=atof(param[10].argument[0].c_str());
635     mgarete->ajouter_ccf(nom,val);
636     }
637     }
638     }
639     if (entite=="COSOMMET")
640     {
641     parse.decode(data.c_str(),"@,@,@",param+2);
642     long idsom=cid(param[2].argument[0]);
643     long idarete=cid(param[3].argument[0]);
644     int num=atoi(param[4].argument[0].c_str());
645     MG_SOMMET* mgsom=mggeo->get_mg_sommetid(idsom);
646     MG_ARETE* mgarete=mggeo->get_mg_areteid(idarete);
647     MG_COSOMMET* mgcosom=mggeo->ajouter_mg_cosommet(id,mgarete,mgsom);
648     if (num==1) mgarete->changer_cosommet1(mgcosom);
649     if (num==2) mgarete->changer_cosommet2(mgcosom);
650     }
651     if (entite=="COARETE")
652     {
653     parse.decode(data.c_str(),"@,@,@",param+2);
654     long idarete=cid(param[2].argument[0]);
655     long idboucle=cid(param[3].argument[0]);
656     int sens=atoi(param[4].argument[0].c_str());
657     MG_ARETE* mgarete=mggeo->get_mg_areteid(idarete);
658     MG_BOUCLE* mgboucle=mggeo->get_mg_boucleid(idboucle);
659     MG_COARETE* mgcoarete=mggeo->ajouter_mg_coarete(id,mgarete,mgboucle,sens);
660     mgboucle->ajouter_mg_coarete(mgcoarete);
661     }
662     if (entite=="VISU_COURBE")
663     {
664     parse.decode(data.c_str(),"@,@,@,@,@,@",param+2);
665     double xyz1[3];
666     double xyz2[3];
667     xyz1[0]=atof(param[2].argument[0].c_str());
668     xyz1[1]=atof(param[3].argument[0].c_str());
669     xyz1[2]=atof(param[4].argument[0].c_str());
670     xyz2[0]=atof(param[5].argument[0].c_str());
671     xyz2[1]=atof(param[6].argument[0].c_str());
672     xyz2[2]=atof(param[7].argument[0].c_str());
673     MG_VISU_COURBE* mgcrb=new MG_VISU_COURBE(id,xyz1,xyz2);
674     mggeo->ajouter_mg_visu_courbe(mgcrb);
675     }
676     if (entite=="MAILLAGE")
677     {
678     parse.decode(data.c_str(),"@",param+2);
679     long idgeo=cid(param[2].argument[0]);
680     MG_GEOMETRIE* mggeo=get_mg_geometrieid(idgeo);
681     mgmai=new MG_MAILLAGE(id,mggeo);
682     ajouter_mg_maillage(mgmai);
683     }
684     if (entite=="FEM_MAILLAGE")
685     {
686     parse.decode(data.c_str(),"@,@,@",param+2);
687     int degre=atoi(param[2].argument[0].c_str());
688     long idmai=cid(param[3].argument[0]);
689     long idgeo=cid(param[4].argument[0]);
690     MG_GEOMETRIE* mggeo=get_mg_geometrieid(idgeo);
691     MG_MAILLAGE* mgmai=get_mg_maillageid(idmai);
692     femmai=new FEM_MAILLAGE(id,mggeo,mgmai,degre);
693     ajouter_fem_maillage(femmai);
694     }
695     if (entite=="NOEUD")
696     {
697 francois 35 parse.decode(data.c_str(),"@,@,@,@,@",param+2);
698 foucault 27 long idtopo=cid(param[2].argument[0]);
699     double x=atof(param[3].argument[0].c_str());
700     double y=atof(param[4].argument[0].c_str());
701     double z=atof(param[5].argument[0].c_str());
702 francois 35 int ori=atoi(param[6].argument[0].c_str());
703 foucault 27 MG_ELEMENT_TOPOLOGIQUE* topo;
704     if (idtopo>-1)
705     {
706     topo=mggeo->get_mg_sommetid(idtopo);
707     if (topo==NULL) topo=mggeo->get_mg_areteid(idtopo);
708     if (topo==NULL) topo=mggeo->get_mg_faceid(idtopo);
709     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
710     }
711     else topo=NULL;
712 francois 35 MG_NOEUD* noeud=new MG_NOEUD(id,topo,x,y,z,ori);
713 foucault 27 mgmai->ajouter_mg_noeud(noeud);
714     }
715     if (entite=="FEM_NOEUD")
716     {
717     parse.decode(data.c_str(),"@,@,@,@,@,@,@",param+2);
718     long idtopo=cid(param[2].argument[0]);
719     long idmai=cid(param[3].argument[0]);
720     double x=atof(param[4].argument[0].c_str());
721     double y=atof(param[5].argument[0].c_str());
722     double z=atof(param[6].argument[0].c_str());
723     int num=atoi(param[7].argument[0].c_str());
724     int numopt=atoi(param[8].argument[0].c_str());
725     MG_ELEMENT_MAILLAGE* elmai;
726     if (idmai>-1)
727     {
728     elmai=mgmai->get_mg_noeudid(idmai);
729     if (elmai==NULL) elmai=mgmai->get_mg_segmentid(idmai);
730     if (elmai==NULL) elmai=mgmai->get_mg_triangleid(idmai);
731     if (elmai==NULL) elmai=mgmai->get_mg_tetraid(idmai);
732     }
733     else elmai=NULL;
734     FEM_NOEUD* noeud;
735     if (elmai!=NULL) noeud=new FEM_NOEUD(id,elmai,x,y,z);
736     else
737     {
738     MG_ELEMENT_TOPOLOGIQUE* topo;
739     if (idtopo>-1)
740     {
741     topo=mggeo->get_mg_sommetid(idtopo);
742     if (topo==NULL) topo=mggeo->get_mg_areteid(idtopo);
743     if (topo==NULL) topo=mggeo->get_mg_faceid(idtopo);
744     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
745     }
746     else topo=NULL;
747     noeud=new FEM_NOEUD(id,topo,x,y,z);
748     }
749     noeud->change_numero(num);
750     noeud->change_numero_opt(numopt);
751     femmai->ajouter_fem_noeud(noeud);
752     }
753     if (entite=="SEGMENT")
754     {
755 francois 35 parse.decode(data.c_str(),"@,@,@,@",param+2);
756 foucault 27 long idtopo=cid(param[2].argument[0]);
757     long idn1=cid(param[3].argument[0]);
758     long idn2=cid(param[4].argument[0]);
759 francois 35 int ori=atoi(param[5].argument[0].c_str());
760 foucault 27 MG_NOEUD* noeud1=mgmai->get_mg_noeudid(idn1);
761     MG_NOEUD* noeud2=mgmai->get_mg_noeudid(idn2);
762     MG_ELEMENT_TOPOLOGIQUE* topo;
763     if (idtopo>-1)
764     {
765     topo=mggeo->get_mg_areteid(idtopo);
766     if (topo==NULL) topo=mggeo->get_mg_faceid(idtopo);
767     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
768     }
769     else topo=NULL;
770 francois 35 MG_SEGMENT* seg=new MG_SEGMENT(id,topo,noeud1,noeud2,ori);
771 foucault 27 mgmai->ajouter_mg_segment(seg);
772     }
773     if (entite=="FEM_SEGMENT2")
774     {
775     parse.decode(data.c_str(),"@,@,@,@",param+2);
776     long idmai=cid(param[3].argument[0]);
777     long idn1=cid(param[4].argument[0]);
778     long idn2=cid(param[5].argument[0]);
779     FEM_NOEUD* tab[2];
780     tab[0]=femmai->get_fem_noeudid(idn1);
781     tab[1]=femmai->get_fem_noeudid(idn2);
782     MG_ELEMENT_MAILLAGE* elmai;
783     if (idmai>-1)
784     elmai=mgmai->get_mg_segmentid(idmai);
785     else elmai=NULL;
786     FEM_SEGMENT2* seg=new FEM_SEGMENT2(id,elmai,tab);
787     femmai->ajouter_fem_segment(seg);
788     }
789     if (entite=="FEM_SEGMENT3")
790     {
791     parse.decode(data.c_str(),"@,@,@,@,@",param+2);
792     long idmai=cid(param[3].argument[0]);
793     long idn1=cid(param[4].argument[0]);
794     long idn2=cid(param[5].argument[0]);
795     long idn3=cid(param[6].argument[0]);
796     FEM_NOEUD* tab[3];
797     tab[0]=femmai->get_fem_noeudid(idn1);
798     tab[1]=femmai->get_fem_noeudid(idn2);
799     tab[2]=femmai->get_fem_noeudid(idn3);
800     MG_ELEMENT_MAILLAGE* elmai;
801     if (idmai>-1)
802     elmai=mgmai->get_mg_segmentid(idmai);
803     else elmai=NULL;
804     FEM_SEGMENT3* seg=new FEM_SEGMENT3(id,elmai,tab);
805     femmai->ajouter_fem_segment(seg);
806     }
807     if (entite=="TRIANGLE")
808     {
809 francois 35 parse.decode(data.c_str(),"@,@,@,@,@",param+2);
810 foucault 27 long idtopo=cid(param[2].argument[0]);
811     long idn1=cid(param[3].argument[0]);
812     long idn2=cid(param[4].argument[0]);
813     long idn3=cid(param[5].argument[0]);
814 francois 35 int ori=atoi(param[6].argument[0].c_str());
815 foucault 27 MG_NOEUD* noeud1=mgmai->get_mg_noeudid(idn1);
816     MG_NOEUD* noeud2=mgmai->get_mg_noeudid(idn2);
817     MG_NOEUD* noeud3=mgmai->get_mg_noeudid(idn3);
818     MG_ELEMENT_TOPOLOGIQUE* topo;
819     if (idtopo>-1)
820     {
821     topo=mggeo->get_mg_faceid(idtopo);
822     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
823     }
824     else topo=NULL;
825 francois 35 mgmai->ajouter_mg_triangle(topo,noeud1,noeud2,noeud3,ori,id);
826 foucault 27 }
827     if (entite=="FEM_TRIANGLE3")
828     {
829     parse.decode(data.c_str(),"@,@,@,@,@",param+2);
830     long idmai=cid(param[3].argument[0]);
831     long idn1=cid(param[4].argument[0]);
832     long idn2=cid(param[5].argument[0]);
833     long idn3=cid(param[6].argument[0]);
834     FEM_NOEUD* tab[3];
835     tab[0]=femmai->get_fem_noeudid(idn1);
836     tab[1]=femmai->get_fem_noeudid(idn2);
837     tab[2]=femmai->get_fem_noeudid(idn3);
838     MG_ELEMENT_MAILLAGE* elmai;
839     if (idmai>-1)
840     elmai=mgmai->get_mg_triangleid(idmai);
841     else elmai=NULL;
842     FEM_TRIANGLE3* tri=new FEM_TRIANGLE3(id,elmai,tab);
843     femmai->ajouter_fem_triangle(tri);
844     }
845     if (entite=="FEM_TRIANGLE6")
846     {
847     parse.decode(data.c_str(),"@,@,@,@,@,@,@,@",param+2);
848     long idmai=cid(param[3].argument[0]);
849     long idn1=cid(param[4].argument[0]);
850     long idn2=cid(param[5].argument[0]);
851     long idn3=cid(param[6].argument[0]);
852     long idn4=cid(param[7].argument[0]);
853     long idn5=cid(param[8].argument[0]);
854     long idn6=cid(param[9].argument[0]);
855     FEM_NOEUD* tab[6];
856     tab[0]=femmai->get_fem_noeudid(idn1);
857     tab[1]=femmai->get_fem_noeudid(idn2);
858     tab[2]=femmai->get_fem_noeudid(idn3);
859     tab[3]=femmai->get_fem_noeudid(idn4);
860     tab[4]=femmai->get_fem_noeudid(idn5);
861     tab[5]=femmai->get_fem_noeudid(idn6);
862     MG_ELEMENT_MAILLAGE* elmai;
863     if (idmai>-1)
864     elmai=mgmai->get_mg_triangleid(idmai);
865     else elmai=NULL;
866     FEM_TRIANGLE6* tri=new FEM_TRIANGLE6(id,elmai,tab);
867     femmai->ajouter_fem_triangle(tri);
868     }
869     if (entite=="TETRAEDRE")
870     {
871 francois 35 parse.decode(data.c_str(),"@,@,@,@,@,@",param+2);
872 foucault 27 long idtopo=cid(param[2].argument[0]);
873     long idn1=cid(param[3].argument[0]);
874     long idn2=cid(param[4].argument[0]);
875     long idn3=cid(param[5].argument[0]);
876     long idn4=cid(param[6].argument[0]);
877 francois 35 int ori=atoi(param[7].argument[0].c_str());
878 foucault 27 MG_NOEUD* noeud1=mgmai->get_mg_noeudid(idn1);
879     MG_NOEUD* noeud2=mgmai->get_mg_noeudid(idn2);
880     MG_NOEUD* noeud3=mgmai->get_mg_noeudid(idn3);
881     MG_NOEUD* noeud4=mgmai->get_mg_noeudid(idn4);
882     MG_ELEMENT_TOPOLOGIQUE* topo;
883     if (idtopo>-1) topo=mggeo->get_mg_volumeid(idtopo);
884     else topo=NULL;
885 francois 35 if (noeud1&&noeud2&&noeud3&&noeud4) mgmai->ajouter_mg_tetra(topo,noeud1,noeud2,noeud3,noeud4,ori,id);
886 foucault 27 }
887     if (entite=="FEM_TETRA4")
888     {
889     parse.decode(data.c_str(),"@,@,@,@,@,@",param+2);
890     long idmai=cid(param[3].argument[0]);
891     long idn1=cid(param[4].argument[0]);
892     long idn2=cid(param[5].argument[0]);
893     long idn3=cid(param[6].argument[0]);
894     long idn4=cid(param[7].argument[0]);
895     FEM_NOEUD* tab[4];
896     tab[0]=femmai->get_fem_noeudid(idn1);
897     tab[1]=femmai->get_fem_noeudid(idn2);
898     tab[2]=femmai->get_fem_noeudid(idn3);
899     tab[3]=femmai->get_fem_noeudid(idn4);
900     MG_ELEMENT_MAILLAGE* elmai;
901     if (idmai>-1)
902     elmai=mgmai->get_mg_tetraid(idmai);
903     else elmai=NULL;
904     FEM_TETRA4* tet=new FEM_TETRA4(id,elmai,tab);
905     femmai->ajouter_fem_tetra(tet);
906     }
907     if (entite=="FEM_TETRA10")
908     {
909     parse.decode(data.c_str(),"@,@,@,@,@,@,@,@,@,@,@,@",param+2);
910     long idmai=cid(param[3].argument[0]);
911     long idn1=cid(param[4].argument[0]);
912     long idn2=cid(param[5].argument[0]);
913     long idn3=cid(param[6].argument[0]);
914     long idn4=cid(param[7].argument[0]);
915     long idn5=cid(param[8].argument[0]);
916     long idn6=cid(param[9].argument[0]);
917     long idn7=cid(param[10].argument[0]);
918     long idn8=cid(param[11].argument[0]);
919     long idn9=cid(param[12].argument[0]);
920     long idn10=cid(param[13].argument[0]);
921     FEM_NOEUD* tab[10];
922     tab[0]=femmai->get_fem_noeudid(idn1);
923     tab[1]=femmai->get_fem_noeudid(idn2);
924     tab[2]=femmai->get_fem_noeudid(idn3);
925     tab[3]=femmai->get_fem_noeudid(idn4);
926     tab[4]=femmai->get_fem_noeudid(idn5);
927     tab[5]=femmai->get_fem_noeudid(idn6);
928     tab[6]=femmai->get_fem_noeudid(idn7);
929     tab[7]=femmai->get_fem_noeudid(idn8);
930     tab[8]=femmai->get_fem_noeudid(idn9);
931     tab[9]=femmai->get_fem_noeudid(idn10);
932     MG_ELEMENT_MAILLAGE* elmai;
933     if (idmai>-1)
934     elmai=mgmai->get_mg_tetraid(idmai);
935     else elmai=NULL;
936     FEM_TETRA10* tet=new FEM_TETRA10(id,elmai,tab);
937     femmai->ajouter_fem_tetra(tet);
938     }
939     if (entite=="SOLUTION")
940     {
941     parse.decode(data.c_str(),"@,@,@,@,(&)",param+2);
942     std::string nomsol=param[2].argument[0];
943     long idmai=cid(param[3].argument[0]);
944     int nb=atoi(param[4].argument[0].c_str());
945     std::string chemin=param[5].argument[0];
946     MG_MAILLAGE* mai=get_mg_maillageid(idmai);
947     MG_SOLUTION* sol=new MG_SOLUTION(id,mai,nb,(char*)chemin.c_str(),SOL_EXISTANTE,nomsol);
948     ajouter_mg_solution(sol);
949     for (int i=0;i<nb;i++)
950     sol->change_legende(i,param[6].argument[i]);
951     }
952     if (entite=="FEM_SOLUTION")
953     {
954     parse.decode(data.c_str(),"@,@,@,@,(&)",param+2);
955     std::string nomsol=param[2].argument[0];
956     long idmai=cid(param[3].argument[0]);
957     int nb=atoi(param[4].argument[0].c_str());
958     std::string chemin=param[5].argument[0];
959     FEM_MAILLAGE* mai=get_fem_maillageid(idmai);
960     FEM_SOLUTION* sol=new FEM_SOLUTION(id,mai,nb,(char*)chemin.c_str(),SOL_EXISTANTE,nomsol);
961     ajouter_fem_solution(sol);
962     for (int i=0;i<nb;i++)
963     sol->change_legende(i,param[6].argument[i]);
964     }
965 souaissa 114 if (entite=="CAD4FE_MCSEGMENT")
966 foucault 27 {
967     parse.decode(data.c_str(),"@,@,@",param+2);
968     long idtopo=cid(param[2].argument[0]);
969     long idn1=cid(param[3].argument[0]);
970     long idn2=cid(param[4].argument[0]);
971     CAD4FE::MCNode* noeud1=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn1);
972     CAD4FE::MCNode* noeud2=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn2);
973     MG_ELEMENT_TOPOLOGIQUE* topo;
974     if (idtopo>-1)
975     {
976     topo=mggeo->get_mg_areteid(idtopo);
977     if (topo==NULL) topo=mggeo->get_mg_faceid(idtopo);
978     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
979     }
980     else topo=NULL;
981     CAD4FE::MCSegment * seg = new CAD4FE::MCSegment(id,topo,noeud1,noeud2);
982     mgmai->ajouter_mg_segment(seg);
983     }
984     if (entite=="CAD4FE_MCNODE")
985     {
986     parse.decode(data.c_str(),"@,@,@,@,@",param+2);
987     long idRefTopo=cid(param[2].argument[0]);
988     long idMCTopo=cid(param[3].argument[0]);
989     double x=atof(param[4].argument[0].c_str());
990     double y=atof(param[5].argument[0].c_str());
991     double z=atof(param[6].argument[0].c_str());
992     MG_ELEMENT_TOPOLOGIQUE* refTopo=NULL;
993     if (refTopo==NULL) refTopo=mggeo->get_mg_sommetid(idRefTopo);
994     if (refTopo==NULL) refTopo=mggeo->get_mg_areteid(idRefTopo);
995     if (refTopo==NULL) refTopo=mggeo->get_mg_faceid(idRefTopo);
996     if (refTopo==NULL) refTopo=mggeo->get_mg_volumeid(idRefTopo);
997     MG_ELEMENT_TOPOLOGIQUE* mcTopo=NULL;
998     if (mcTopo==NULL) mcTopo=mggeo->get_mg_sommetid(idMCTopo);
999     if (mcTopo==NULL) mcTopo=mggeo->get_mg_areteid(idMCTopo);
1000     if (mcTopo==NULL) mcTopo=mggeo->get_mg_faceid(idMCTopo);
1001     if (mcTopo==NULL) mcTopo=mggeo->get_mg_volumeid(idMCTopo);
1002    
1003     if (mcTopo->get_dimension()==0)
1004     {
1005     if (updatedMergedRefVertices == false)
1006     {
1007     for (std::multimap<CAD4FE::MCVertex * , unsigned long>::iterator itMergedRefVertices = mapMergedRefVertices.begin();
1008     itMergedRefVertices != mapMergedRefVertices.end();
1009     itMergedRefVertices++)
1010     {
1011     CAD4FE::MCVertex * v = itMergedRefVertices->first;
1012     MG_SOMMET * refV = NULL;
1013     unsigned long id = itMergedRefVertices->second;
1014     refV = (MG_SOMMET *) mggeo->get_mg_sommetid(id);
1015     v->MergeRefVertex(refV);
1016     }
1017    
1018     updatedMergedRefVertices = true;
1019     }
1020     }
1021    
1022     CAD4FE::MCNode* noeud=new CAD4FE::MCNode(id,mcTopo,refTopo,x,y,z);
1023     mgmai->ajouter_mg_noeud(noeud);
1024     }
1025     if (entite=="CAD4FE_MCTRIANGLE")
1026     {
1027     parse.decode(data.c_str(),"@,@,@,@",param+2);
1028     long idtopo=cid(param[2].argument[0]);
1029     long idn1=cid(param[3].argument[0]);
1030     long idn2=cid(param[4].argument[0]);
1031     long idn3=cid(param[5].argument[0]);
1032     CAD4FE::MCNode* noeud1=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn1);
1033     CAD4FE::MCNode* noeud2=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn2);
1034     CAD4FE::MCNode* noeud3=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn3);
1035 souaissa 114 CAD4FE::MCSegment* mgsegment[3];
1036     CAD4FE::MCNode *mgnoeud[3]={noeud1,noeud2,noeud3};
1037     // la topo. d'un MCTriangle est obligatoirement une MCFace
1038 foucault 27 CAD4FE::MCFace* mcFace=(CAD4FE::MCFace*)mggeo->get_mg_faceid(idtopo);
1039     for (int i=0;i<3;i++)
1040 souaissa 114 {
1041     mgsegment[i]=(CAD4FE::MCSegment*)mgmai->get_mg_segment(mgnoeud[i]->get_id(),mgnoeud[(i+1)%3]->get_id());
1042     if (mgsegment[i]==NULL)
1043     {
1044     mgsegment[i]=new CAD4FE::MCSegment(mcFace,mgnoeud[i],mgnoeud[(i+1)%3]);
1045     mgmai->ajouter_mg_segment(mgsegment[i]);
1046     }
1047     }
1048 foucault 27 CAD4FE::M3D_MCTriangle *triangle = new CAD4FE::M3D_MCTriangle(id,mcFace,noeud1,noeud2,noeud3,mgsegment[0],mgsegment[1],mgsegment[2]);
1049     mgmai->ajouter_mg_triangle(triangle);
1050 souaissa 114 }
1051 foucault 27 }
1052     }
1053     while (param[0].argument[0]!="FIN");
1054 souaissa 114
1055 foucault 27 if (updatedMergedRefVertices == false)
1056     {
1057     for (std::multimap<CAD4FE::MCVertex * , unsigned long>::iterator itMergedRefVertices = mapMergedRefVertices.begin();
1058     itMergedRefVertices != mapMergedRefVertices.end();
1059     itMergedRefVertices++)
1060     {
1061     CAD4FE::MCVertex * v = itMergedRefVertices->first;
1062     MG_SOMMET * refV = NULL;
1063     unsigned long id = itMergedRefVertices->second;
1064     refV = (MG_SOMMET *) mggeo->get_mg_sommetid(id);
1065     v->MergeRefVertex(refV);
1066     }
1067    
1068     updatedMergedRefVertices = true;
1069     }
1070    
1071 souaissa 114
1072 foucault 27 fclose(in);
1073     #ifdef BREP_SLD
1074     fonction->Fermer();
1075     #endif
1076     return 1;
1077     }
1078    
1079    
1080    
1081