ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/fichier/src/mg_file.cpp
Revision: 210
Committed: Fri Jul 31 16:19:04 2009 UTC (15 years, 9 months ago) by francois
Original Path: magic/lib/fichier/fichier/src/mg_file.cpp
File size: 57621 byte(s)
Log Message:
Nouvelle facon de representer la deforme + groupe topologique pour le maillage + bug idmax

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