ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/fichier/src/mg_file.cpp
Revision: 174
Committed: Wed Apr 22 21:46:09 2009 UTC (16 years ago) by francois
Original Path: magic/lib/fichier/fichier/src/mg_file.cpp
File size: 56021 byte(s)
Log Message:
Plusieurs modif importantes : 
1) la fonction un point appartient a une face est generique donc le mailleurbloc et le remailleur utilise la methode generic
2) dans une boucle il y une methode qui permet de connaitre la coarete suivante et precedente
3) Des solutions sont possibles aux elements. Attention le format de fichier magic est change pour SOLUTION. Il y a un parametre different. Si il y a des solutions dans le fichier il n y a pas compatibilite avec le format d'avant

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