ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/fichier/src/mg_file.cpp
Revision: 195
Committed: Thu Jul 16 22:05:49 2009 UTC (15 years, 10 months ago) by francois
Original Path: magic/lib/fichier/fichier/src/mg_file.cpp
File size: 57101 byte(s)
Log Message:
Ajout de groupe de topologie pour appliquer des algos sur une partie du fichier magic seulement
Ajout de methode qui permette de connaitre la topologie sous jacente a une topologie donnee
Gestion des maillages FEM qui ne sont attaches a une geometrie

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     if (entite=="SEGMENT")
782     {
783 francois 35 parse.decode(data.c_str(),"@,@,@,@",param+2);
784 foucault 27 long idtopo=cid(param[2].argument[0]);
785     long idn1=cid(param[3].argument[0]);
786     long idn2=cid(param[4].argument[0]);
787 francois 35 int ori=atoi(param[5].argument[0].c_str());
788 foucault 27 MG_NOEUD* noeud1=mgmai->get_mg_noeudid(idn1);
789     MG_NOEUD* noeud2=mgmai->get_mg_noeudid(idn2);
790     MG_ELEMENT_TOPOLOGIQUE* topo;
791     if (idtopo>-1)
792     {
793     topo=mggeo->get_mg_areteid(idtopo);
794     if (topo==NULL) topo=mggeo->get_mg_faceid(idtopo);
795     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
796     }
797     else topo=NULL;
798 francois 35 MG_SEGMENT* seg=new MG_SEGMENT(id,topo,noeud1,noeud2,ori);
799 foucault 27 mgmai->ajouter_mg_segment(seg);
800     }
801     if (entite=="FEM_SEGMENT2")
802     {
803     parse.decode(data.c_str(),"@,@,@,@",param+2);
804     long idmai=cid(param[3].argument[0]);
805     long idn1=cid(param[4].argument[0]);
806     long idn2=cid(param[5].argument[0]);
807     FEM_NOEUD* tab[2];
808     tab[0]=femmai->get_fem_noeudid(idn1);
809     tab[1]=femmai->get_fem_noeudid(idn2);
810     MG_ELEMENT_MAILLAGE* elmai;
811     if (idmai>-1)
812     elmai=mgmai->get_mg_segmentid(idmai);
813     else elmai=NULL;
814     FEM_SEGMENT2* seg=new FEM_SEGMENT2(id,elmai,tab);
815     femmai->ajouter_fem_segment(seg);
816     }
817     if (entite=="FEM_SEGMENT3")
818     {
819     parse.decode(data.c_str(),"@,@,@,@,@",param+2);
820     long idmai=cid(param[3].argument[0]);
821     long idn1=cid(param[4].argument[0]);
822     long idn2=cid(param[5].argument[0]);
823     long idn3=cid(param[6].argument[0]);
824     FEM_NOEUD* tab[3];
825     tab[0]=femmai->get_fem_noeudid(idn1);
826     tab[1]=femmai->get_fem_noeudid(idn2);
827     tab[2]=femmai->get_fem_noeudid(idn3);
828     MG_ELEMENT_MAILLAGE* elmai;
829     if (idmai>-1)
830     elmai=mgmai->get_mg_segmentid(idmai);
831     else elmai=NULL;
832     FEM_SEGMENT3* seg=new FEM_SEGMENT3(id,elmai,tab);
833     femmai->ajouter_fem_segment(seg);
834     }
835     if (entite=="TRIANGLE")
836     {
837 francois 35 parse.decode(data.c_str(),"@,@,@,@,@",param+2);
838 foucault 27 long idtopo=cid(param[2].argument[0]);
839     long idn1=cid(param[3].argument[0]);
840     long idn2=cid(param[4].argument[0]);
841     long idn3=cid(param[5].argument[0]);
842 francois 35 int ori=atoi(param[6].argument[0].c_str());
843 foucault 27 MG_NOEUD* noeud1=mgmai->get_mg_noeudid(idn1);
844     MG_NOEUD* noeud2=mgmai->get_mg_noeudid(idn2);
845     MG_NOEUD* noeud3=mgmai->get_mg_noeudid(idn3);
846     MG_ELEMENT_TOPOLOGIQUE* topo;
847     if (idtopo>-1)
848     {
849     topo=mggeo->get_mg_faceid(idtopo);
850     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
851     }
852     else topo=NULL;
853 francois 35 mgmai->ajouter_mg_triangle(topo,noeud1,noeud2,noeud3,ori,id);
854 foucault 27 }
855     if (entite=="FEM_TRIANGLE3")
856     {
857     parse.decode(data.c_str(),"@,@,@,@,@",param+2);
858     long idmai=cid(param[3].argument[0]);
859     long idn1=cid(param[4].argument[0]);
860     long idn2=cid(param[5].argument[0]);
861     long idn3=cid(param[6].argument[0]);
862     FEM_NOEUD* tab[3];
863     tab[0]=femmai->get_fem_noeudid(idn1);
864     tab[1]=femmai->get_fem_noeudid(idn2);
865     tab[2]=femmai->get_fem_noeudid(idn3);
866     MG_ELEMENT_MAILLAGE* elmai;
867     if (idmai>-1)
868     elmai=mgmai->get_mg_triangleid(idmai);
869     else elmai=NULL;
870     FEM_TRIANGLE3* tri=new FEM_TRIANGLE3(id,elmai,tab);
871     femmai->ajouter_fem_triangle(tri);
872     }
873     if (entite=="FEM_TRIANGLE6")
874     {
875     parse.decode(data.c_str(),"@,@,@,@,@,@,@,@",param+2);
876     long idmai=cid(param[3].argument[0]);
877     long idn1=cid(param[4].argument[0]);
878     long idn2=cid(param[5].argument[0]);
879     long idn3=cid(param[6].argument[0]);
880     long idn4=cid(param[7].argument[0]);
881     long idn5=cid(param[8].argument[0]);
882     long idn6=cid(param[9].argument[0]);
883     FEM_NOEUD* tab[6];
884     tab[0]=femmai->get_fem_noeudid(idn1);
885     tab[1]=femmai->get_fem_noeudid(idn2);
886     tab[2]=femmai->get_fem_noeudid(idn3);
887     tab[3]=femmai->get_fem_noeudid(idn4);
888     tab[4]=femmai->get_fem_noeudid(idn5);
889     tab[5]=femmai->get_fem_noeudid(idn6);
890     MG_ELEMENT_MAILLAGE* elmai;
891     if (idmai>-1)
892     elmai=mgmai->get_mg_triangleid(idmai);
893     else elmai=NULL;
894     FEM_TRIANGLE6* tri=new FEM_TRIANGLE6(id,elmai,tab);
895     femmai->ajouter_fem_triangle(tri);
896     }
897     if (entite=="TETRAEDRE")
898     {
899 francois 35 parse.decode(data.c_str(),"@,@,@,@,@,@",param+2);
900 foucault 27 long idtopo=cid(param[2].argument[0]);
901     long idn1=cid(param[3].argument[0]);
902     long idn2=cid(param[4].argument[0]);
903     long idn3=cid(param[5].argument[0]);
904     long idn4=cid(param[6].argument[0]);
905 francois 35 int ori=atoi(param[7].argument[0].c_str());
906 foucault 27 MG_NOEUD* noeud1=mgmai->get_mg_noeudid(idn1);
907     MG_NOEUD* noeud2=mgmai->get_mg_noeudid(idn2);
908     MG_NOEUD* noeud3=mgmai->get_mg_noeudid(idn3);
909     MG_NOEUD* noeud4=mgmai->get_mg_noeudid(idn4);
910     MG_ELEMENT_TOPOLOGIQUE* topo;
911     if (idtopo>-1) topo=mggeo->get_mg_volumeid(idtopo);
912     else topo=NULL;
913 francois 35 if (noeud1&&noeud2&&noeud3&&noeud4) mgmai->ajouter_mg_tetra(topo,noeud1,noeud2,noeud3,noeud4,ori,id);
914 foucault 27 }
915     if (entite=="FEM_TETRA4")
916     {
917     parse.decode(data.c_str(),"@,@,@,@,@,@",param+2);
918     long idmai=cid(param[3].argument[0]);
919     long idn1=cid(param[4].argument[0]);
920     long idn2=cid(param[5].argument[0]);
921     long idn3=cid(param[6].argument[0]);
922     long idn4=cid(param[7].argument[0]);
923     FEM_NOEUD* tab[4];
924     tab[0]=femmai->get_fem_noeudid(idn1);
925     tab[1]=femmai->get_fem_noeudid(idn2);
926     tab[2]=femmai->get_fem_noeudid(idn3);
927     tab[3]=femmai->get_fem_noeudid(idn4);
928     MG_ELEMENT_MAILLAGE* elmai;
929     if (idmai>-1)
930     elmai=mgmai->get_mg_tetraid(idmai);
931     else elmai=NULL;
932     FEM_TETRA4* tet=new FEM_TETRA4(id,elmai,tab);
933     femmai->ajouter_fem_tetra(tet);
934     }
935     if (entite=="FEM_TETRA10")
936     {
937     parse.decode(data.c_str(),"@,@,@,@,@,@,@,@,@,@,@,@",param+2);
938     long idmai=cid(param[3].argument[0]);
939     long idn1=cid(param[4].argument[0]);
940     long idn2=cid(param[5].argument[0]);
941     long idn3=cid(param[6].argument[0]);
942     long idn4=cid(param[7].argument[0]);
943     long idn5=cid(param[8].argument[0]);
944     long idn6=cid(param[9].argument[0]);
945     long idn7=cid(param[10].argument[0]);
946     long idn8=cid(param[11].argument[0]);
947     long idn9=cid(param[12].argument[0]);
948     long idn10=cid(param[13].argument[0]);
949     FEM_NOEUD* tab[10];
950     tab[0]=femmai->get_fem_noeudid(idn1);
951     tab[1]=femmai->get_fem_noeudid(idn2);
952     tab[2]=femmai->get_fem_noeudid(idn3);
953     tab[3]=femmai->get_fem_noeudid(idn4);
954     tab[4]=femmai->get_fem_noeudid(idn5);
955     tab[5]=femmai->get_fem_noeudid(idn6);
956     tab[6]=femmai->get_fem_noeudid(idn7);
957     tab[7]=femmai->get_fem_noeudid(idn8);
958     tab[8]=femmai->get_fem_noeudid(idn9);
959     tab[9]=femmai->get_fem_noeudid(idn10);
960     MG_ELEMENT_MAILLAGE* elmai;
961     if (idmai>-1)
962     elmai=mgmai->get_mg_tetraid(idmai);
963     else elmai=NULL;
964     FEM_TETRA10* tet=new FEM_TETRA10(id,elmai,tab);
965     femmai->ajouter_fem_tetra(tet);
966     }
967     if (entite=="SOLUTION")
968     {
969 francois 174 parse.decode(data.c_str(),"@,@,@,@,@,(&)",param+2);
970     int typeentite=atoi(param[2].argument[0].c_str());
971     std::string nomsol=param[3].argument[0];
972     long idmai=cid(param[4].argument[0]);
973     int nb=atoi(param[5].argument[0].c_str());
974     std::string chemin=param[6].argument[0];
975 foucault 27 MG_MAILLAGE* mai=get_mg_maillageid(idmai);
976 francois 174 MG_SOLUTION* sol=new MG_SOLUTION(id,mai,nb,(char*)chemin.c_str(),SOL_EXISTANTE,nomsol,typeentite);
977 foucault 27 ajouter_mg_solution(sol);
978     for (int i=0;i<nb;i++)
979 francois 174 sol->change_legende(i,param[7].argument[i]);
980 foucault 27 }
981     if (entite=="FEM_SOLUTION")
982     {
983 francois 174 parse.decode(data.c_str(),"@,@,@,@,@,(&)",param+2);
984     int typeentite=atoi(param[2].argument[0].c_str());
985     std::string nomsol=param[3].argument[0];
986     long idmai=cid(param[4].argument[0]);
987     int nb=atoi(param[5].argument[0].c_str());
988     std::string chemin=param[6].argument[0];
989 foucault 27 FEM_MAILLAGE* mai=get_fem_maillageid(idmai);
990 francois 174 FEM_SOLUTION* sol=new FEM_SOLUTION(id,mai,nb,(char*)chemin.c_str(),SOL_EXISTANTE,nomsol,typeentite);
991 foucault 27 ajouter_fem_solution(sol);
992     for (int i=0;i<nb;i++)
993 francois 174 sol->change_legende(i,param[7].argument[i]);
994 foucault 27 }
995 francois 174 #ifdef WINDOWS_VERSION
996 francois 136 if (entite=="CAD4FE_MCSEGMENT")
997 foucault 27 {
998     parse.decode(data.c_str(),"@,@,@",param+2);
999     long idtopo=cid(param[2].argument[0]);
1000     long idn1=cid(param[3].argument[0]);
1001     long idn2=cid(param[4].argument[0]);
1002     CAD4FE::MCNode* noeud1=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn1);
1003     CAD4FE::MCNode* noeud2=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn2);
1004     MG_ELEMENT_TOPOLOGIQUE* topo;
1005     if (idtopo>-1)
1006     {
1007     topo=mggeo->get_mg_areteid(idtopo);
1008     if (topo==NULL) topo=mggeo->get_mg_faceid(idtopo);
1009     if (topo==NULL) topo=mggeo->get_mg_volumeid(idtopo);
1010     }
1011     else topo=NULL;
1012     CAD4FE::MCSegment * seg = new CAD4FE::MCSegment(id,topo,noeud1,noeud2);
1013     mgmai->ajouter_mg_segment(seg);
1014     }
1015     if (entite=="CAD4FE_MCNODE")
1016     {
1017     parse.decode(data.c_str(),"@,@,@,@,@",param+2);
1018     long idRefTopo=cid(param[2].argument[0]);
1019     long idMCTopo=cid(param[3].argument[0]);
1020     double x=atof(param[4].argument[0].c_str());
1021     double y=atof(param[5].argument[0].c_str());
1022     double z=atof(param[6].argument[0].c_str());
1023     MG_ELEMENT_TOPOLOGIQUE* refTopo=NULL;
1024     if (refTopo==NULL) refTopo=mggeo->get_mg_sommetid(idRefTopo);
1025     if (refTopo==NULL) refTopo=mggeo->get_mg_areteid(idRefTopo);
1026     if (refTopo==NULL) refTopo=mggeo->get_mg_faceid(idRefTopo);
1027     if (refTopo==NULL) refTopo=mggeo->get_mg_volumeid(idRefTopo);
1028     MG_ELEMENT_TOPOLOGIQUE* mcTopo=NULL;
1029     if (mcTopo==NULL) mcTopo=mggeo->get_mg_sommetid(idMCTopo);
1030     if (mcTopo==NULL) mcTopo=mggeo->get_mg_areteid(idMCTopo);
1031     if (mcTopo==NULL) mcTopo=mggeo->get_mg_faceid(idMCTopo);
1032     if (mcTopo==NULL) mcTopo=mggeo->get_mg_volumeid(idMCTopo);
1033    
1034     if (mcTopo->get_dimension()==0)
1035     {
1036     if (updatedMergedRefVertices == false)
1037     {
1038     for (std::multimap<CAD4FE::MCVertex * , unsigned long>::iterator itMergedRefVertices = mapMergedRefVertices.begin();
1039     itMergedRefVertices != mapMergedRefVertices.end();
1040     itMergedRefVertices++)
1041     {
1042     CAD4FE::MCVertex * v = itMergedRefVertices->first;
1043     MG_SOMMET * refV = NULL;
1044     unsigned long id = itMergedRefVertices->second;
1045     refV = (MG_SOMMET *) mggeo->get_mg_sommetid(id);
1046     v->MergeRefVertex(refV);
1047     }
1048    
1049     updatedMergedRefVertices = true;
1050     }
1051     }
1052    
1053     CAD4FE::MCNode* noeud=new CAD4FE::MCNode(id,mcTopo,refTopo,x,y,z);
1054     mgmai->ajouter_mg_noeud(noeud);
1055     }
1056     if (entite=="CAD4FE_MCTRIANGLE")
1057     {
1058     parse.decode(data.c_str(),"@,@,@,@",param+2);
1059     long idtopo=cid(param[2].argument[0]);
1060     long idn1=cid(param[3].argument[0]);
1061     long idn2=cid(param[4].argument[0]);
1062     long idn3=cid(param[5].argument[0]);
1063     CAD4FE::MCNode* noeud1=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn1);
1064     CAD4FE::MCNode* noeud2=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn2);
1065     CAD4FE::MCNode* noeud3=(CAD4FE::MCNode*)mgmai->get_mg_noeudid(idn3);
1066 francois 174 CAD4FE::MCSegment* mgsegment[3];
1067     CAD4FE::MCNode *mgnoeud[3]={noeud1,noeud2,noeud3};
1068     // la topo. d'un MCTriangle est obligatoirement une MCFace
1069 foucault 27 CAD4FE::MCFace* mcFace=(CAD4FE::MCFace*)mggeo->get_mg_faceid(idtopo);
1070     for (int i=0;i<3;i++)
1071 francois 174 {
1072     mgsegment[i]=(CAD4FE::MCSegment*)mgmai->get_mg_segment(mgnoeud[i]->get_id(),mgnoeud[(i+1)%3]->get_id());
1073     if (mgsegment[i]==NULL)
1074     {
1075     mgsegment[i]=new CAD4FE::MCSegment(mcFace,mgnoeud[i],mgnoeud[(i+1)%3]);
1076     mgmai->ajouter_mg_segment(mgsegment[i]);
1077     }
1078     }
1079 foucault 27 CAD4FE::M3D_MCTriangle *triangle = new CAD4FE::M3D_MCTriangle(id,mcFace,noeud1,noeud2,noeud3,mgsegment[0],mgsegment[1],mgsegment[2]);
1080     mgmai->ajouter_mg_triangle(triangle);
1081 francois 174 }
1082 francois 136 #endif
1083 foucault 27 }
1084     }
1085     while (param[0].argument[0]!="FIN");
1086 francois 136 #ifdef WINDOWS_VERSION
1087 foucault 27 if (updatedMergedRefVertices == false)
1088     {
1089     for (std::multimap<CAD4FE::MCVertex * , unsigned long>::iterator itMergedRefVertices = mapMergedRefVertices.begin();
1090     itMergedRefVertices != mapMergedRefVertices.end();
1091     itMergedRefVertices++)
1092     {
1093     CAD4FE::MCVertex * v = itMergedRefVertices->first;
1094     MG_SOMMET * refV = NULL;
1095     unsigned long id = itMergedRefVertices->second;
1096     refV = (MG_SOMMET *) mggeo->get_mg_sommetid(id);
1097     v->MergeRefVertex(refV);
1098     }
1099    
1100     updatedMergedRefVertices = true;
1101     }
1102    
1103 francois 136 #endif
1104 foucault 27 fclose(in);
1105     #ifdef BREP_SLD
1106     fonction->Fermer();
1107     #endif
1108     return 1;
1109     }
1110    
1111    
1112    
1113