8 #include "ghs3dprl_mesh_wrap.h"
11 using namespace med_2_2;
13 //************************************
14 CVWtab::CVWtab(long nb, med_int *pmint)
15 //constructor with pmint allocated yet with new
17 //cout"***constructor med_int CVWtab***\n";
19 type=1; //only tmint valide
24 //************************************
25 CVWtab::CVWtab(long nb, med_float *pmflo)
26 //constructor with pmflo allocated yet with new
28 //cout<<"***constructor med_float CVWtab***\n";
30 type=2; //only tmflo valide
35 //************************************
39 //cout<<" destructor CVWtab *** "<<this->filename<<endl;
40 ok=this->CVWtab_deallocate();
41 //remove temporary file
42 if (this->filename!="_NO_FILE")
44 remove(this->filename); //#include <stdio.h>
45 //cout<<this->filename<<" successfully deleted\n";
50 //************************************
51 bool CVWtab::CVWtab_deallocate()
53 //cout<<" deallocate CVWtab*** "<<size<<endl;
54 if (size <= 0) return FALSE;
58 size=-size; //precaution
63 size=-size; //precaution
68 //************************************
69 bool CVWtab::is_equal(CVWtab *tab2)
71 //cout<<"is_equal tab1 tab2 type="<<this->type<<" size="<<this->size<<" "<<tab2->size<<endl;
72 //if (this->type==1) cout<<"med_int tab1[0]="<<this->tmint[0]<<endl;
73 //if (this->type==2) cout<<"med_float tab1[0]="<<this->tmflo[0]<<endl;
74 if (this->size!=tab2->size) return FALSE;
75 if (this->type!=tab2->type) return FALSE;
79 { cout<<"***is_equal*** pb pointer NULL with tmint size="<<this->size<<endl;
82 for (long i=0; i < this->size; i++)
83 if (this->tmint[i]!=tab2->tmint[i]) return FALSE;
88 { cout<<"***is_equal*** pb pointer NULL with tmflo size="<<this->size<<endl;
91 for (long i=0; i < this->size; i++)
92 if (this->tmflo[i]!=tab2->tmflo[i]) return FALSE;
97 //************************************
98 bool CVW_is_equal_vertices(CVWtab *tab1, long i1,
99 CVWtab *tab2, long i2, int verbose)
100 //verbose 0 for no prints
101 //verbose 1 for print vertices not equals
102 //verbose 2 for print also vertices equals (debug)
104 //cout<<"is_equal_vertice size="<<tab1->size<<" "<<tab2->size<<endl;
107 //vertices indices from 1 not 0!
108 long di1=(i1-1)*3, di2=(i2-1)*3;
109 if (di1<0 || di1>=tab1->size)
111 cerr<<"BadIndice tab1 in is_equal_vertices "<<
112 di1<<" not in "<<tab1->size<<endl;
115 if (di2<0 || di2>=tab2->size)
117 cerr<<"BadIndice tab2 in is_equal_vertices "<<
118 di2<<" not in "<<tab2->size<<endl;
121 p1=(tab1->tmflo+di1);
122 p2=(tab2->tmflo+di2);
123 if (p1[0]==p2[0] && p1[1]==p2[1] && p1[2]==p2[2]) ok=TRUE ;
124 if (!ok && verbose>0) printf(
125 "Vertices differents (%.16g %.16g %.16g) (%.16g %.16g %.16g)\n",
126 p1[0],p1[1],p1[2],p2[0],p2[1],p2[2]);
128 if (verbose>1) printf(
129 "Vertices equals (%.16g %.16g %.16g)\n",
134 //************************************
135 bool CVW_FindString(const string &str,fstream &Ff, long &count)
136 //find in file first line with string str in first position of line
137 //converts count value expected after "='" in line found
142 if (getline(Ff,line))
144 if (line[0]==str[0]) //faster
146 if (line.find(str)==0)
150 count=tmp.section('\'',1,1).toLong(&ok);
157 cerr<<"Problem line '"<<str<<"' not found in file\n"<<endl;
164 //************************************
165 bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName)
166 //read file .glo with no parser xml because big file (volume)
169 fstream Ff((const char *)FileName,ios_base::in);
176 cerr<<"Problem File '"<<FileName<<"' not open\n"<<endl;
181 if (!CVW_FindString("<vertices count=",Ff,count)) return FALSE;
182 if (this->verbose>2) cout<<"VerticesCount="<<count<<endl;
185 med_int *tmint=new med_int[count];
186 for (int i=0; i<count; i++) Ff>>tmint[i];
187 if (this->verbose>4) cout<<"Elements "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<endl;
189 CVWtab *montab=new CVWtab(count,tmint);
190 tmp=tmp.sprintf("GL%ld VE",this->nofile);
191 ok=this->insert_key(tmp,montab);
194 if (!CVW_FindString("<edges count=",Ff,count)) return FALSE;
195 if (this->verbose>2) cout<<"EdgesCount="<<count<<endl;
198 med_int *tmint=new med_int[count];
199 for (int i=0; i<count; i++) Ff>>tmint[i];
200 if (this->verbose>4) cout<<"Elements "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<endl;
202 CVWtab *montab=new CVWtab(count,tmint);
203 tmp=tmp.sprintf("GL%ld ED",this->nofile);
204 ok=this->insert_key(tmp,montab);
207 if (!CVW_FindString("<faces count=",Ff,count)) return FALSE;
208 if (this->verbose>2) cout<<"FacesCount="<<count<<endl;
211 med_int *tmint=new med_int[count];
212 for (int i=0; i<count; i++) Ff>>tmint[i];
213 if (this->verbose>4) cout<<"Elements "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<endl;
215 CVWtab *montab=new CVWtab(count,tmint);
216 tmp=tmp.sprintf("GL%ld FA",this->nofile);
217 ok=this->insert_key(tmp,montab);
220 if (!CVW_FindString("<elements count=",Ff,count)) return FALSE;
221 if (this->verbose>2) cout<<"ElementsCount="<<count<<endl;
224 med_int *tmint=new med_int[count];
225 for (int i=0; i<count; i++) Ff>>tmint[i];
226 if (this->verbose>4) cout<<"Elements "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[count-1]<<endl;
228 CVWtab *montab=new CVWtab(count,tmint);
229 tmp=tmp.sprintf("GL%ld EL",this->nofile);
230 ok=this->insert_key(tmp,montab);
238 //************************************
239 bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName)
240 //read file .faces (wrap)
243 fstream Ff((const char *)FileName,ios_base::in);
250 cerr<<"Problem File '"<<FileName<<"' not open\n"<<endl;
255 //Replace le pointeur de fichier au début :f.seekg(0);
256 if (getline(Ff,line))
259 nbelem=tmp.section(' ',0,0).toLong(&ok);
263 cerr<<"Problem on first line of file"<<endl;
266 if (this->verbose>2) cout<<"NumberOfElements="<<nbelem<<endl;
267 med_int *tmint=new med_int[nbelem*7];
268 for (int i=0; i<nbelem*7; i=i+7)
271 if (ntype!=3) //only triangles
273 cerr<<"Problem on ntype != 3"<<endl;
276 for (int j=0; j<7; j++) Ff>>tmint[i+j];
277 //for (int j=0; j<7; j++) cout<<tmint[i+j]<<' '; cout<<endl;
279 if (this->verbose>4) cout<<"Elements "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[nbelem*7-1]<<endl;
281 CVWtab *montab=new CVWtab(nbelem*7,tmint);
282 tmp=tmp.sprintf("FC%ld",this->nofile);
283 ok=this->insert_key(tmp,montab);
290 //************************************
291 bool ghs3dprl_mesh_wrap::ReadFileNOBOITE(const QString FileName)
292 //read file .noboite (volume)
293 //for huge files it could be better use ReadFileNOBOITEB (B=binary format)
294 //(parameter option of ghs3d but NOT tepal)
297 fstream Ff((const char *)FileName,ios_base::in);
298 long ne,np,npfixe,subnumber,reste;
303 cerr<<"Problem File '"<<FileName<<"' not open\n"<<endl;
311 cout<<"NumberOfElements="<<ne<<endl;
312 cout<<"NumberOfVertices="<<np<<endl;
313 cout<<"NumberOfSpecifiedPoints="<<npfixe<<endl;
315 for (int i=1; i<=17-3; i++) Ff>>reste;
316 //printf("reste %ld\n",reste);
317 med_int *tmint=new med_int[ne*4];
318 for (int i=0; i<ne*4; i++) Ff>>tmint[i];
319 if (this->verbose>4) cout<<"Elements "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[ne*4-1]<<endl;
321 CVWtab *montab=new CVWtab(ne*4,tmint);
322 tmp=tmp.sprintf("NB%ld EV",this->nofile);
323 ok=this->insert_key(tmp,montab);
325 med_float *tmflo=new med_float[np*3];
326 for (int i=0; i<np*3; i++) Ff>>tmflo[i];
327 if (this->verbose>4) cout<<"Vertices "<<tmflo[0]<<" "<<tmflo[1]<<"... "<<tmflo[np*3-1]<<endl;
329 montab=new CVWtab(np*3,tmflo);
330 tmp=tmp.sprintf("NB%ld VC",this->nofile);
331 ok=this->insert_key(tmp,montab);
334 if (this->verbose>2) cout<<"NumberOfSubdomains="<<subnumber<<endl;
335 tmint=new med_int[subnumber*3];
336 for (int i=0; i<subnumber*3; i++) Ff>>tmint[i];
337 if (this->verbose>4) cout<<"Subdomains "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[subnumber*3-1]<<endl;
339 montab=new CVWtab(subnumber*3,tmint);
340 tmp=tmp.sprintf("NB%ld SN",this->nofile);
341 ok=this->insert_key(tmp,montab);
343 //beware record 6 lenght 1
350 //************************************
351 bool ghs3dprl_mesh_wrap::ReadFileNOBOITEB(const QString FileName)
352 //read file .noboiteb (volume)
353 //for huge files it could be better use ReadFileNOBOITEB (B=binary format)
354 //but NOT parameter option of tepal
355 //idem ReadFileNOBOITE with read unformatted
359 cerr<<"Problem function ReadFileNOBOITEB\n"
360 <<"(no FORTRAN binary format files in tepal)\n\n";
364 FILE *Ff=fopen((const char *)FileName,"rb");
365 long ne,np,npfixe,reste,subnumber; /*,cube,npbli,
366 nbele,loele,nbelef,loelef,
367 nbpoi,lopoi,nbpoif,lopoif,
368 nbsub,losub,nbsubf,losubf,reste;*/
370 //http://www.math.utah.edu/software/c-with-fortran.html
371 //record 1 from format FORTRAN begins and ends with lengh of record
372 //=> 2*long(68) (68=17*4octets)
377 cerr<<"Problem File '"<<FileName<<"' not open\n"<<endl;
382 fread(&r1,sizeof(long),17+2,Ff);
383 for (long i=1; i<18; i++) cout<<"R1("<<i<<")="<<r1[i]<<endl;
387 cerr<<"First FORTRAN record of File '"<<FileName<<"' not length 17*long"<<endl;
395 cout<<"NumberOfElements="<<ne<<endl;
396 cout<<"NumberOfVertices="<<np<<endl;
397 cout<<"NumberOfSpecifiedPoints="<<npfixe<<endl;
399 ///etc...could be done if necessary not debugged
400 fread(&reste,sizeof(long),1,Ff);
401 long *tlong=new long[ne*4];
402 med_int *tmint=new med_int[ne*4];
403 fread(tlong,sizeof(long),ne*4,Ff);
404 fread(&reste,sizeof(long),1,Ff);
405 for (long i=0; i<ne*4; i++) tmint[i]=tlong[i];
407 if (this->verbose>4) cout<<"Elements "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[ne*4-1]<<endl;
409 CVWtab *montab=new CVWtab(ne*4,tmint);
410 tmp=tmp.sprintf("NB%ld EV",this->nofile);
411 ok=this->insert_key(tmp,montab);
413 fread(&reste,sizeof(long),1,Ff);
414 //cout<<"info "<<reste<<" "<<np*3<<" "<<sizeof(med_float)<<endl;
415 float *tfloat=new float[np*3];
416 med_float *tmflo=new med_float[np*3];
417 fread(tfloat,sizeof(float),np*3,Ff);
418 fread(&reste,sizeof(long),1,Ff);
419 for (long i=0; i<np*3; i++) tmflo[i]=tfloat[i];
421 if (this->verbose>4) printf("Vertices %g %g ... %g \n",tmflo[0],tmflo[1],tmflo[np*3-1]);
423 montab=new CVWtab(np*3,tmflo);
424 tmp=tmp.sprintf("NB%ld VC",this->nofile);
425 ok=this->insert_key(tmp,montab);
427 fread(&reste,sizeof(long),1,Ff);
428 fread(&subnumber,sizeof(long),1,Ff);
429 fread(&reste,sizeof(long),1,Ff);
430 if (this->verbose>2) cout<<"NumberOfSubdomains="<<subnumber<<endl;
431 fread(&reste,sizeof(long),1,Ff);
432 tlong=new long[subnumber*3];
433 fread(tlong,sizeof(long),subnumber*3,Ff);
434 fread(&reste,sizeof(long),1,Ff);
435 if (this->verbose>4) printf("Subdomains %ld %ld ... %ld \n",tlong[0],tlong[1],tlong[subnumber*3-1]);
437 tmint=new med_int[subnumber*3];
438 for (long i=0; i<subnumber*3; i++) tmint[i]=tlong[i];
440 montab=new CVWtab(subnumber*3,tmint);
441 tmp=tmp.sprintf("NB%ld SN",this->nofile);
442 ok=this->insert_key(tmp,montab);
444 //beware record 6 lenght 1
452 //************************************
453 bool ghs3dprl_mesh_wrap::ReadFilePOINTS(const QString FileName)
454 //read file .points (wrap)
464 //NOT Raw because Raw=non-buffered file access
465 ok=Ff.open(IO_ReadOnly|IO_Translate);
468 cerr<<"Problem File '"<<FileName<<"' not open\n"<<endl;
472 lg=Ff.readLine(tmp,maxlen);
473 tmp=tmp.simplifyWhiteSpace();
477 cerr<<"Problem conversion File '"<<FileName<<"\n"<<endl;
480 if (this->verbose>2) cout<<"NumberOfVertices="<<nb<<endl;
481 med_float *tmflo=new med_float[3*nb]; //coordinates
482 med_int *tmint=new med_int[nb]; //nrs (attribute of point)
484 for ( long il=0; il<nb; il++ )
486 lg=Ff.readLine(tmp,maxlen);
487 tmp=tmp.simplifyWhiteSpace();
488 //cout<<"lu '"<<tmp<<"'"<<lg<<endl;
489 for ( int j=0; j<3; j++ )
491 tmflo[il3]=tmp.section(' ',j,j).toDouble(&ok);
492 //cout<<"cv '"<<tmflo[il3]<<"' "<<il3<<endl;
496 cerr<<"Problem conversion File '"<<FileName<<"\n"<<endl;
500 //nrs is vertex attribute
501 tmint[il]=tmp.section(' ',3,3).toLong(&ok);
504 cerr<<"Problem conversion File '"<<FileName<<"\n"<<endl;
508 //beware no examples with each specified points (if any) here
510 {CVWtab *montab=new CVWtab(nb,tmint); //init montab->tmint nrs
511 tmp=tmp.sprintf("PO%ld NRS",this->nofile);
512 ok=this->insert_key(tmp,montab);}
514 {CVWtab *montab=new CVWtab(nb,tmflo); //init montab->tmflo xyz
515 tmp=tmp.sprintf("PO%ld XYZ",this->nofile);
516 ok=this->insert_key(tmp,montab);}
524 //************************************
525 bool ghs3dprl_mesh_wrap::list_keys_mesh_wrap()
527 QDictIterator<CVWtab> it( this->mestab);
528 for ( ; it.current(); ++it )
530 string nom=it.currentKey();
532 cout<<nom<<"-> size="<<it.current()->size<<endl;
537 //************************************
538 long ghs3dprl_mesh_wrap::remove_all_keys_mesh_wrap()
540 long nb=this->remove_key_mesh_wrap(QRegExp(".",TRUE,FALSE));
544 //************************************
545 long ghs3dprl_mesh_wrap::remove_key_mesh_wrap(const QRegExp &rxp)
549 QDictIterator<CVWtab> it(this->mestab);
550 for ( ; it.current(); ++it )
554 long i=it.currentKey().contains(rxp);
559 if (this->verbose>4) cout<<"remove key "<<it.currentKey()<<endl;
561 this->mestab.remove(it.currentKey());
564 //All dictionary iterators that refer to the removed item
565 //will be set to point to the next item
566 //in the dictionary's traversal order
572 //************************************
573 bool SwapOnFile(const QString &key,const QString &path,CVWtab *tab,int verbose)
577 if (tab->filename=="_NO_FILE")
579 tab->filename=path+key+".tmp";
580 tab->filename.replace(" ","_"); //replace " " by "_"
582 //swap disque binaire
583 //montab->tmint=new long[10]; //for test
584 //for (int i=0; i<10; i++) montab->tmint[i]=i*2;
585 FILE *fichier=fopen(tab->filename,"wb");
588 fwrite(&taille,sizeof(taille),1,fichier);
592 cout<<"SwapOnFile in binary file "<<tab->filename<<
593 " number of elements "<<taille<<
594 " size_element med_int "<<sizeof(med_int)<<
595 " total_size_binary " <<taille*sizeof(med_int)<<endl;
596 fwrite(tab->tmint,sizeof(med_int),taille,fichier);
597 //fread(&gagnants,sizeof(gagnants),1,fichier);
602 cout<<"SwapOnFile in binary file "<<tab->filename<<
603 " number of elements "<<taille<<
604 " size_element med_float "<<sizeof(med_float)<<
605 " total_size_binary " <<taille*sizeof(med_float)<<endl;
606 fwrite(tab->tmflo,sizeof(med_float),taille,fichier);
612 if (verbose>3) cout<<"SwapOnFile in binary file done yet "<<tab->filename<<endl;
614 //deallocate because swap disk binary mode
615 tab->CVWtab_deallocate(); //free memory
619 //************************************
620 long ghs3dprl_mesh_wrap::SwapOutOfMemory_key_mesh_wrap(const QRegExp &rxp)
625 QDictIterator<CVWtab> it(this->mestab);
626 for ( ; it.current(); ++it )
628 long i=it.currentKey().contains(rxp);
632 if (it.current()->size>0)
633 ok=SwapOnFile(it.currentKey(),this->path,it.current(),this->verbose); //free memory
634 //if (this->verbose) cout<<"SwapOutOfMemory key "<<it.currentKey()<<endl;
639 //************************************
640 bool ghs3dprl_mesh_wrap::list_onekey_mesh_wrap(const QString &key)
642 CVWtab *montab=this->mestab[key];
645 //cout<<"key "<<key<<"trouvee -> size="<<montab->size<<endl;
647 for ( long i=0; i<montab->size; i++ )
648 cout<<montab->tmint[i]<<" ";
650 for ( long i=0; i<montab->size; i++ )
651 cout<<montab->tmflo[i]<<" ";
655 cout<<"key "<<key<<" not found"<<endl;
659 //************************************
660 bool ghs3dprl_mesh_wrap::insert_key(const QString &key,CVWtab *tab)
661 //insertion conditionnée par limite this->nbelem_limit_swap
662 //si tableaux contenus on dimension superieure
663 //alors swap disque dans getenv(tmp) fichier temporaire binaire
667 cout<<"InsertKey "<<key<<" size="<<tab->size<<endl;
668 tab->filename="_NO_FILE";
669 if (this->nbelem_limit_swap < tab->size)
670 ok=SwapOnFile(key,this->path,tab,this->verbose);
671 this->mestab.insert(key,tab);
674 //************************************
675 CVWtab* ghs3dprl_mesh_wrap::restore_key(const QString &key)
676 //retauration conditionnée par limite nbelem
677 //si tableaux contenus on dimension superieure a nbelem
678 //alors swap disque dans getenv(tmp) fichier temporaire
679 //alors lecture du fichier (et reallocate memory)
682 tab=this->mestab[key];
683 /*if (tab) cout<<" -> size in proc "<<tab->size<<endl;
684 else cout<<" -> tab NULL\n";*/
685 if (!tab) //it is NOT a problem
687 if (this->verbose>6) cout<<"restore_key key not found "<<key<<endl;
692 if (this->verbose>5) cout<<"restore_key direct from memory "<<key<<" size="<<tab->size<<endl;
695 //restore from binary file
696 if ((tab->type<1)||(tab->type>2))
698 cerr<<"Problem restore_key from binary file "<<tab->filename<<
699 " type unexpexted "<<tab->type<<endl;
702 //cout<<"restore_key from binary file "<<tab->filename<<endl;
704 //swap disque binaire
705 FILE *fichier=fopen(tab->filename,"rb");
707 fread(&taille,sizeof(long),1,fichier);
708 if (taille!=-tab->size)
710 cerr<<"Problem restore_key from binary file "<<tab->filename<<
711 " size unexpexted "<<taille<<" expected "<<-tab->size<<endl;
718 cout<<"restore_key from binary file "<<tab->filename<<
719 " number of elements "<<taille<<
720 " size_element med_float "<<sizeof(med_float)<<
721 " total_size_binary " <<taille*sizeof(med_float)<<endl;
723 //allocate because swap disque binaire
724 tab->tmint=new med_int[taille]; //allocate memory
725 fread(tab->tmint,sizeof(med_int),taille,fichier);
730 cout<<"restore_key from binary file "<<tab->filename<<
731 " number of elements "<<taille<<
732 " size_element med_float "<<sizeof(med_float)<<
733 " total_size_binary " <<taille*sizeof(med_float)<<endl;
734 //allocate because swap disque binaire
735 tab->tmflo=new med_float[taille]; //allocate memory
736 for (int i=0; i<taille ; i++) tab->tmflo[i]=-1e0;
737 fread(tab->tmflo,sizeof(med_float),taille,fichier);
738 /*for (int i=0; i<taille ; i++) cout<<tab->tmflo[i]<<"/";
742 tab->size=-tab->size;
746 //************************************
747 bool ghs3dprl_mesh_wrap::test_msg_wrap()
748 //tests sur resultats fichiers msg
750 QString key1,key2,typ="FA VE ED EL"; //pour faces vertice edges elements
754 //numerotations locales sont identiques
755 long nb=typ.contains(' ',TRUE) + 1; //nb chiffres detectes
756 for (long i=0; i < nb; i++)
757 for (long ifile=1; ifile <= this->nbfiles; ifile++)
758 for (long ineig=1; ineig <= this->nbfiles; ineig++)
760 if (ifile==ineig) continue; //impossible
761 key1=key1.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" SE";
762 key2=key2.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" RE";
763 //cout<<"key "<<key1<<" et key "<<key2<<endl;
764 tab1=this->restore_key(key1);
765 //tab1=this->mestab[key1];
766 tab2=this->restore_key(key2);
767 //tab2=this->mestab[key2];
768 //cout<<"sortie key "<<key1<<" et key "<<key2<<endl;
769 if (!tab1 && !tab2) continue; //case not neighbours
771 { cout<<"key "<<key1<<" inexistante avec key "<<key2<<" existante"<<endl;
777 { cout<<"key "<<key2<<" inexistante avec key "<<key1<<" existante"<<endl;
781 if (!tab1->is_equal(tab2))
782 { cout<<"key "<<key1<<" et key "<<key2<<" de contenu differents"<<endl;
787 printf("key '%s' et key '%s' identiques \n",
788 (const char *)key2,(const char *)key1);*/
791 //test size neighbourg=ifile
792 //numerotations locales sont differentes mais de tailles identiques
793 //pas besoin de verifier " RE " car deja fait au dessus
794 for (long i=0; i < nb; i++)
795 for (long ifile=1; ifile <= this->nbfiles; ifile++)
796 for (long ineig=ifile+1; ineig <= this->nbfiles; ineig++)
798 if (ifile==ineig) continue; //cas impossible
799 key1=key1.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" SE";
800 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
801 key2=key2.sprintf("MS%ld NE%ld ",ineig,ifile)+typ.section(' ',i,i)+" SE";
802 tab2=this->restore_key(key2); //tab2=this->mestab[key2];
803 if (!tab1 && !tab2) continue; //case not neighbours
805 { cout<<"key "<<key1<<" inexistante avec key "<<key2<<" existante"<<endl;
811 { cout<<"key "<<key2<<" inexistante avec key "<<key1<<" existante"<<endl;
815 if ((tab1->type!=tab2->type)||(tab1->size!=tab2->size))
816 { cout<<"key "<<key1<<" et key "<<key2<<" de type ou tailles differents"<<endl;
824 //************************************
825 bool ghs3dprl_mesh_wrap::test_vertices_wrap()
828 QString key1,key2,key11,key22,key11old,key22old;
829 CVWtab *tab1,*tab2,*tab11,*tab22;
831 key11old="_NO_KEY";key22old="_NO_KEY";
832 //test size neighbourg=ifile
833 //numerotations locales sont differentes mais de tailles identiques
834 //pas besoin de verifier " RE " car deja fait au dessus
835 //for (int ifile=1; ifile <= this->nbfiles; ifile++)
836 //for (int ineig=ifile+1; ineig <= this->nbfiles; ineig++)
837 for (int ifile=this->nbfiles; ifile >= 1; ifile--)
838 for (int ineig=this->nbfiles; ineig >= ifile+1; ineig--)
840 if (ifile==ineig) continue; //cas impossible
841 key1=key1.sprintf("MS%d NE%d VE SE",ifile,ineig);
842 key11=key11.sprintf("NB%d VC",ifile);
843 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
844 key2=key2.sprintf("MS%d NE%d VE SE",ineig,ifile);
845 key22=key22.sprintf("NB%d VC",ineig);
846 tab2=this->restore_key(key2); //tab2=this->mestab[key2];
847 if (!tab1 && !tab2) continue; //cas non voisins
850 cerr<<"TestEqualityCoordinates key "<<key1<<" NOT existing but key "<<key2<<" existing"<<endl;
855 cerr<<"TestEqualityCoordinates key "<<key2<<" NOT existing but key "<<key1<<" existing"<<endl;
858 if (tab1->size!=tab2->size)
860 cerr<<"TestEqualityCoordinates key "<<key1<<" and key "<<key2<<" NOT same size"<<endl;
865 //Swap out of memory if no use
866 if ((key11old!=key11)&&(key11old!=key22))
867 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key11old,TRUE,FALSE));
868 if ((key22old!=key11)&&(key22old!=key22))
869 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key22old,TRUE,FALSE));
871 tab11=this->restore_key(key11); //tab11=this->mestab[key11];
872 tab22=this->restore_key(key22); //tab22=this->mestab[key22];
875 //test on equality of xyz_coordinates of commons vertices
876 for (long j=0; j < tab1->size-1; j++)
880 //1 for print vertices not equals
881 if (!CVW_is_equal_vertices(tab11,i1,tab22,i2,1))
883 cerr<<j<<" Vertice "<<i1<<" != Vertice "<<i2<<"\n"<<endl;
887 if ((this->verbose>2)&&(ok1))
888 cout<<"TestEqualityCoordinates "<<tab1->size<<
889 " Vertices "<<key1<<" and "<<key2<<" ok"<<endl;
891 cerr<<"TestEqualityCoordinates "<<tab1->size<<
892 " Vertices "<<key1<<" and "<<key2<<" NO_OK"<<endl;
893 key11old=key11; key22old=key22;
896 //Swap out of memory (supposed no use?)
897 //NO because NB1&NB2 VC supposed future use
899 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key11old,TRUE,FALSE));
900 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key22old,TRUE,FALSE));
904 //************************************
905 bool ghs3dprl_mesh_wrap::Write_MEDfiles()
907 bool ok=FALSE,oklocal;
908 QString key1,tmp,filename;
911 char namelocal[MED_TAILLE_NOM+1]; //no more 32
912 char distfilename[MED_TAILLE_DESC+1];
913 char description[MED_TAILLE_DESC+1];
916 //precaution because casename->med_namelocal no more 32 character
917 //if path, in this->path.
918 //20 preserve for add postfixes "_idom" etc...
919 this->casename=this->casename.section('/',-1);
920 if (this->casename.length()>20)
922 cerr<<"CaseNameMed truncated (no more 20 characters)"<<endl;
923 this->casename.truncate(20);
925 filename=this->path+this->casename;
926 ofstream file(filename); //master file
927 file<<"#MED Fichier V 2.3"<<" "<<endl;
928 file<<"# NumbersOfSubDomains"<<" "<<endl;
929 int nbdomains=this->nbfiles;
930 file<<nbdomains<<" "<<endl;
932 //loop on the domains
933 for (int idom=1; idom<=nbdomains; idom++)
936 ostringstream suffix;
937 suffix<<filename<<"_"<<idom<<".med";
938 strcpy(distfilename,suffix.str().c_str());
939 //tmp=filename+tmp.sprintf("_%d.med",idom);
940 //strcpy(distfilename,tmp);
943 if (this->verbose>2) cout<<endl;
944 cout<<"CreateMEDFile "<<idom<<" "<<distfilename<<endl;
947 med_idt fid=MEDouvrir(distfilename,MED_CREATION);
948 if (fid<0) cerr<<"Problem MEDouvrir "<<distfilename<<endl;
950 //updating the ascii master description file
951 tmp=tmp.sprintf(this->casename+"_%d",idom);
952 file<<this->casename<<" "<<idom<<" "<<
953 tmp<<" "<<"localhost "<<distfilename<<" "<<endl;
956 strcpy(namelocal,tmp);
957 tmp=tmp.sprintf("domain %d among %d",idom,nbdomains);
958 strcpy(description,tmp);
959 if (this->verbose>4) cout<<"File "<<distfilename<<" : "<<description<<endl;
960 //cout<<namelocal<<":"<<description<<endl
961 err=MEDmaaCr(fid,namelocal,3,MED_NON_STRUCTURE,description);
962 if (err<0) cerr<<"Problem MEDmaaCr"<<endl;
964 //writing node(vertices) coordinates
965 //NBx VC=files.NoBoite Vertex Coordinates
966 // 123456789012345612345678901234561234567890123456
967 char nomcoo[3*MED_TAILLE_PNOM+1]="x y z ";
968 char unicoo[3*MED_TAILLE_PNOM+1]="? ? ? ";
969 key1=key1.sprintf("NB%d VC",idom); //files.NoBoite Vertex Coordinates
970 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
971 med_int nbnodes=tab1->size/3;
973 /*(med_idt fid, char *maa, med_int mdim, med_float *coo,
974 med_mode_switch mode_switch, med_int n,
975 med_repere type_rep, char *nom, char *unit)*/
976 err=MEDcoordEcr(fid,namelocal,3,tab1->tmflo,MED_FULL_INTERLACE,
977 nbnodes,MED_CART,nomcoo,unicoo);
978 if (err<0) cerr<<"Problem MEDcoordEcr"<<endl;
979 if (this->verbose>4)cout<<"NumberOfNodes="<<nbnodes<<endl;
980 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key1,TRUE,FALSE));
982 //writing indices of nodes
983 med_int *arrayi=new med_int[nbnodes];
984 for (long i=0; i<nbnodes ; i++) arrayi[i]=i+1;
985 med_2_2::med_geometrie_element medgeoele0=(med_2_2::med_geometrie_element) 0;
986 err=MEDnumEcr(fid,namelocal,arrayi,nbnodes,MED_NOEUD,medgeoele0);
987 if (err<0) cerr<<"Problem MEDnumEcr of nodes"<<endl;
990 //writing connectivity of faces triangles of wrap by nodes
991 key1=key1.sprintf("FC%d",idom); //files.FaCes faces (wrap and triangles only)
992 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
993 med_int nbfaces=tab1->size/7;
994 if (this->verbose>4) cout<<"NumberOfTrianglesOfWrap="<<nbfaces<<endl;
995 arrayi=new med_int[nbfaces*3];
997 for (long j=0; j<nbfaces ; j++)
999 arrayi[ii]=tab1->tmint[i]; ii++;
1000 arrayi[ii]=tab1->tmint[i+1]; ii++;
1001 arrayi[ii]=tab1->tmint[i+2]; ii++;
1004 err=MEDconnEcr(fid,namelocal,3,arrayi,MED_FULL_INTERLACE,nbfaces,MED_FACE,MED_TRIA3,MED_NOD);
1005 if (err<0) cerr<<"Problem MEDconnEcr for triangles connectivity"<<endl;
1008 //writing indices of faces triangles of wrap
1010 //generate "overlapping of numbers of elements" in "import med file" in salome
1011 //if not in "//writing indices of tetraedes" -> arrayi[i]=!NBFACES!+i+1
1012 arrayi=new med_int[nbfaces];
1013 for (long i=0; i<nbfaces ; i++) arrayi[i]=i+1;
1014 err=MEDnumEcr(fid,namelocal,arrayi,nbfaces,MED_FACE,MED_TRIA3);
1015 if (err<0) cerr<<"Problem MEDnumEcr of triangles"<<endl;
1018 //create global family wrap default
1019 char nomfam[MED_TAILLE_NOM+1]="PART_OF_GLOBAL_WRAP";
1020 char attdes[MED_TAILLE_DESC+1]="part of wrap of global volume";
1021 char gro[MED_TAILLE_LNOM+1]="PART_OF_GLOBAL_WRAP";
1022 med_int numfam,attide,attval,natt,ngro,numfam_ini_wrap=200;
1023 //caution numfam_ini_wrap!=numfam_ini_nodes
1024 numfam=-numfam_ini_wrap; attide=1; attval=numfam; natt=1; ngro=1;
1025 err=MEDfamCr(fid,namelocal,nomfam,numfam,&attide,&attval,attdes,natt,gro,ngro);
1026 if (err<0) cerr<<"Problem MEDfamCr of "<<nomfam<<endl;
1029 //init default indices of families of faces triangles of wrap = -numfam_ini_wrap
1030 //(for faces not in joints=PART_OF_GLOBAL_WRAP, why not!)
1031 //others -> -numfam_ini_wrap-indice_of_neighbourg ([1;number_of_neighbourg])
1032 //(for existing joints)
1033 int sizefamilies=nbfaces;
1034 med_int *familiesi=new med_int[sizefamilies];
1035 for (int i=0; i<sizefamilies ; i++) familiesi[i]=-numfam_ini_wrap;
1037 //families known in faces in wrap PART_OF_GLOBAL_WRAP
1038 //writing indices of families of faces triangles of wrap = nsd why not?
1039 //not implemented yet because subdomain(s) of family PART_OF_GLOBAL_WRAP
1040 /*arrayi=new med_int[nbfaces];
1041 for (int i=0; i<nbfaces ; i++) arrayi[i]=tab1->tmint[(i*7)+3];
1042 err=MEDfamEcr(fid,namelocal,arrayi,nbfaces,MED_FACE,MED_TRIA3);
1043 if (err<0) cerr<<"Problem MEDfamEcr faces of wrap"<<endl;
1046 //writing connectivity of tetraedes by nodes
1047 key1=key1.sprintf("NB%d EV",idom); //files.NoBoite Elements Vertices (tetra only)
1048 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
1049 med_int nbtetras=tab1->size/4;
1050 if (this->verbose>4) cout<<"NumberOfTetraedes="<<nbtetras<<endl;
1051 //arrayi=new med_int[tab1->size];
1052 //for (long i=0; i<tab1->size ; i++) arrayi[i]=tab1->tmint[i];
1053 err=MEDconnEcr(fid,namelocal,3,tab1->tmint,MED_FULL_INTERLACE,nbtetras,MED_MAILLE,MED_TETRA4,MED_NOD);
1054 if (err<0) cerr<<"Problem MEDconnEcr for tetra connectivity"<<endl;
1056 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key1,TRUE,FALSE));
1058 //writing indices of tetraedes
1059 arrayi=new med_int[nbtetras];
1060 for (long i=0; i<nbtetras ; i++) arrayi[i]=nbfaces+i+1;
1061 err=MEDnumEcr(fid,namelocal,arrayi,nbtetras,MED_MAILLE,MED_TETRA4);
1062 if (err<0) cerr<<"Problem MEDnumEcr of tetraedes"<<endl;
1065 //writing indices of families of nodes = nrs why not?
1066 //before create families of nodes fonction of existing values of nrs of files .points
1067 arrayi=new med_int[nbnodes];
1068 key1=key1.sprintf("PO%d NRS",idom); //files.POints Vertex of wrap
1069 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
1070 med_int nbwrap=tab1->size;
1071 //families known in points in wrap
1072 //more than 30 families is stupid? (too many)?
1073 int itest,i2,ifam[30],imax=1,imess=0,numfam_ini_nodes=numfam_ini_wrap-100;
1074 //caution numfam_ini_wrap!=numfam_ini_nodes
1075 //ifam[:]<-existing values of nrs (in [0,97])
1076 //ifam[0]<-first family default=99 for new nodes IN volume (out of wrap)
1078 for (int i=0; i<nbwrap ; i++)
1080 itest=tab1->tmint[i];
1081 if ((itest<0)||(itest>97))
1085 cerr<<"Problem for domain "<<idom<<" nrs="<<itest<<
1086 " shoud be in [0;97] forced 98"<<endl;
1087 imess=1; //message only once
1089 itest=98; //0<=nrs<=97 precaution 98=family garbage
1091 arrayi[i]=-numfam_ini_nodes-itest;
1097 ifam[imax]=itest ; imax++ ; break;
1099 if (itest==ifam[i2]) break;
1104 cerr<<"Problem more than 30 families of nodes"<<endl;
1108 for (int i=0 ; i<imax ; i++)
1110 //create families of nodes as nrs
1112 tmp=tmp.sprintf("IN_VOLUME");
1114 tmp=tmp.sprintf("NRS_%d",ifam[i]);
1116 if (this->verbose>2) cout<<"CreateFamilyOfNodes_"<<nomfam<<endl;
1119 tmp=tmp.sprintf("nodes in local volume");
1121 tmp=tmp.sprintf("nodes of nrs_%d on local wrap",ifam[i]);
1123 numfam=-numfam_ini_nodes-ifam[i];
1128 if (this->verbose>4) cout<<"MEDfamCr (nodes) of "<<nomfam<<" / "<<attdes<<" / FamilyNumber="<<numfam<<endl;
1129 err=MEDfamCr(fid,namelocal,nomfam,numfam,&attide,&attval,attdes,natt,gro,ngro);
1130 if (err<0) cerr<<"Problem MEDfamCr of "<<nomfam<<endl;
1132 //defaults ifam[0] for new points in new volume
1133 for (int i=nbwrap; i<nbnodes ; i++) arrayi[i]=-numfam_ini_nodes-ifam[0];
1135 err=MEDfamEcr(fid,namelocal,arrayi,nbnodes,MED_NOEUD,medgeoele0);
1136 if (err<0) cerr<<"Problem MEDfamEcr nodes"<<endl;
1139 /*Le nom du maillage local est une chaîne de MED_TAILLE_NOM (32) caractères.
1140 Le tableau des numéros "num" est un tableau à 1 dimension de taille égale à "n".
1141 Les numéros globaux sont obligatoirement supérieur à 1
1142 Le type de l'entite "typent" est soit MED_NOEUD,MED_MAILLE, MED_FACE ou MED_ARETE.
1143 Le type géométrique peut être :
1144 Pour les noeuds : 0.
1145 Pour les mailles : MED_POINT1, MED_SEG2, MED_SEG3, MED_TRIA3, MED_TRIA6, MED_QUAD4, MED_QUAD8, MED_POLYGONE.
1146 Pour les faces : MED_TRIA3, MED_TRIA6, MED_QUAD4, MED_QUAD8, MED_POLYGONE.
1147 Pour les arêtes : MED_SEG2 et MED_SEG3.*/
1149 //writing nodes(vertices) global numbering
1150 //GLx VE=files.GLo VErtices
1151 key1=key1.sprintf("GL%d VE",idom);
1152 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
1154 if (this->verbose>2)
1155 cout<<"CreateMEDglobalNumerotation_Nodes "<<key1<<" "<<tab1->size<<endl;
1156 if (nbnodes<=0) cerr<<"Problem MEDglobalNumEcr not in memory"<<endl;
1157 //arrayi=new med_int[nbnodes];
1158 //for (int i=0; i<tab1->size ; i++) arrayi[i]=tab1->tmint[i];
1159 //med_2_2::med_geometrie_element toto=MED_POINT1;
1160 //cout<<"MED_POINT1="<<toto<<" medgeoele0="<<medgeoele0<<endl;
1161 /*MEDglobalNumEcr(med_idt fid, char *maa, med_int *num, med_int n,
1162 med_entite_maillage type_ent, med_geometrie_element type_geo)*/
1163 err=MEDglobalNumEcr(fid,namelocal,tab1->tmint,nbnodes,MED_NOEUD,medgeoele0);
1164 if (err<0) cerr<<"Problem MEDglobalNumEcr nodes"<<endl;
1165 //cout<<"MEDglobalNumEcr vertices size="<<nbnodes<<endl;
1167 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key1,TRUE,FALSE));
1169 //writing faces(triangles) global numbering
1170 //GLx FA=files.GLo FAces
1171 key1=key1.sprintf("GL%d FA",idom);
1172 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
1174 //arrayi=new med_int[nbfaces];
1175 //for (int i=0; i<tab1->size ; i++) arrayi[i]=tab1->tmint[i];
1176 if (this->verbose>2)
1177 cout<<"CreateMEDglobalNumerotation_Faces "<<key1<<" "<<tab1->size<<endl;
1178 err=MEDglobalNumEcr(fid,namelocal,tab1->tmint,nbfaces,MED_FACE,MED_TRIA3);
1179 if (err<0) cerr<<"Problem MEDglobalNumEcr faces"<<endl;
1180 //cout<<"MEDglobalNumEcr faces size="<<nbfaces<<endl;
1182 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key1,TRUE,FALSE));
1184 //writing tetraedes global numbering
1185 //GLx EL=files.GLo ELements
1186 key1=key1.sprintf("GL%d EL",idom);
1187 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
1188 med_int nbtetrasglo=tab1->size;
1189 if (nbtetrasglo!=nbtetras)
1190 cerr<<"Problem incorrect size of tetraedes global numbering"<<endl;
1191 //arrayi=new med_int[nbtetrasglo];
1192 //for (int i=0; i<tab1->size ; i++) arrayi[i]=tab1->tmint[i];
1193 if (this->verbose>2)
1194 cout<<"CreateMEDglobalNumerotation_Tetraedes "<<key1<<" "<<tab1->size<<endl;
1195 err=MEDglobalNumEcr(fid,namelocal,tab1->tmint,nbtetrasglo,MED_MAILLE,MED_TETRA4);
1196 if (err<0) cerr<<"Problem MEDglobalNumEcr tetraedes"<<endl;
1197 //cout<<"MEDglobalNumEcr tetraedes size="<<nbtetrasglo<<endl;
1199 this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key1,TRUE,FALSE));
1202 for (int ineig=1; ineig <= this->nbfiles; ineig++)
1204 char namejnt[MED_TAILLE_NOM+1]; //no more 32
1205 char namedist[MED_TAILLE_NOM+1];
1206 char descjnt[MED_TAILLE_DESC+1];
1208 if (idom==ineig) continue; //impossible
1209 key1=key1.sprintf("MS%d NE%d VE SE",idom,ineig); //SE or RE?
1210 tab1=this->restore_key(key1);
1211 if (!tab1) continue; //case (ifile,ineig) are not neighbours=>no joints
1212 key1=key1.sprintf("MS%d NE%d VE RE",idom,ineig); //SE or RE
1213 tab2=tab1; //tab2=this->restore_key(key1); //no need because <send> equals <receive>
1214 if (!tab2) cerr<<"Problem nodes joint <send> with no <receive> in file .msg"<<endl;
1217 if (this->verbose>4)
1218 cout<<"NumberOfNodesOfJoint_"<<ineig<<"="<<nbnodes<<endl;
1219 strcpy(namejnt,tmp.sprintf("joint_%d",ineig));
1220 tmp=tmp.sprintf("joint_%d among %d domains of ",ineig,nbdomains)+namelocal;
1221 strcpy(descjnt,tmp);
1222 //cout<<descjnt<<endl;
1223 strcpy(namedist,tmp.sprintf("joint_%d",idom)); //or this->casename+"_%d",ineig));
1224 err=MEDjointCr(fid,namelocal,namejnt,descjnt,ineig,namedist);
1225 if (err<0) cerr<<"Problem MEDjointCr"<<endl;
1227 //writing correspondence nodes-nodes
1228 //two indices for one correspondence
1229 arrayi=new med_int[nbnodes*2];
1231 for (int i=0; i<nbnodes ; i++)
1233 //no need because <send> equals <receive> tab1->tmint[i]==tab2->tmint[i]
1234 arrayi[ii]=tab1->tmint[i]; ii++;
1235 arrayi[ii]=tab2->tmint[i]; ii++;
1237 err=MEDjointEcr(fid,namelocal,namejnt,arrayi,nbnodes,
1238 MED_NOEUD,medgeoele0,MED_NOEUD,medgeoele0);
1239 if (err<0) cerr<<"Problem MEDjointEcr nodes"<<endl;
1242 //writing correspondence triangles-triangles
1243 key1=key1.sprintf("MS%d NE%d FA SE",idom,ineig); //SE or RE?
1244 tab1=this->restore_key(key1); //tab1=this->mestab[key1];
1247 if (this->verbose>4)
1248 cout<<"NumberOfTrianglesOfJoint_"<<ineig<<"="<<0<<endl;
1249 continue; //case (ifile,ineig) are not neighbours=>no joints
1251 key1=key1.sprintf("MS%d NE%d FA RE",idom,ineig); //SE or RE?
1252 tab2=tab1; //tab2=this->restore_key(key1); //no need because <send> equals <receive>
1253 if (!tab2) cerr<<"Problem triangles joint send with no receive"<<endl;
1254 med_int nbtriangles=tab1->size;
1256 if (this->verbose>4)
1257 cout<<"NumberOfTrianglesOfJoint_"<<ineig<<"="<<nbtriangles<<endl;
1258 arrayi=new med_int[nbtriangles*2];
1260 for (int i=0; i<nbtriangles ; i++)
1262 //no need because <send> equals <receive> tab1->tmint[i]==tab2->tmint[i]
1263 arrayi[ii]=tab1->tmint[i]; ii++;
1264 familiesi[tab1->tmint[i]-1]=-numfam_ini_wrap-ineig;
1265 arrayi[ii]=tab2->tmint[i]; ii++;
1266 //cout<<arrayi[ii-1]<<"="<<arrayi[ii-2]<<endl;
1268 err=MEDjointEcr(fid,namelocal,namejnt,arrayi,nbtriangles,MED_FACE,MED_TRIA3,MED_FACE,MED_TRIA3);
1269 if (err<0) cerr<<"Problem MEDjointEcr triangles"<<endl;
1272 tmp=tmp.sprintf("JOINT_%d",ineig);
1275 //err=MEDnumEcr(fid,nomfam,arrayi,nbtriangles,MED_FACE,MED_TRIA3);
1276 //if (err<0) cerr<<"Problem MEDnumEcr of triangles of "<<nomfam<<endl;
1278 //char gro[MED_TAILLE_LNOM+1]="PART_OF_GLOBAL_WRAP_PLUS_JOINTS";
1280 /*char gro[MED_TAILLE_LNOM*2+1];
1281 strcpy(gro,"PART_OF_GLOBAL_WRAP_PLUS_JOINTS ");
1282 for (int i=32;i<MED_TAILLE_LNOM;i++) gro[i]=' ';
1283 gro[MED_TAILLE_LNOM]='\0';
1285 //for (i=7;i<MED_TAILLE_LNOM;i++) gro[MED_TAILLE_LNOM+i]=' ';
1286 //gro[2*MED_TAILLE_LNOM]='\0';*/
1288 tmp=tmp.sprintf("joint of neighbourg_%d on local wrap",ineig);
1290 numfam=-numfam_ini_wrap-ineig;
1295 if (this->verbose>2)
1296 cout<<"CreateFamilyOfFaces_"<<nomfam<<endl;
1297 if (this->verbose>4) cout<<"MEDfamCr (faces) of "<<nomfam<<" / "<<attdes<<" / FamilyNumber="<<numfam<<endl;
1299 err=MEDfamCr(fid,namelocal,nomfam,numfam,&attide,&attval,attdes,natt,gro,ngro);
1300 if (err<0) cerr<<"Problem MEDfamCr of "<<nomfam<<endl;
1303 //writing indices of families of faces triangles of wrap = joint<-100 or not=100?
1304 //arrayi=new med_int[nbtriangles];
1305 //families known in faces in wrap
1306 //for (int i=0; i<nbtriangles ; i++) arrayi[i]=-100-ineig; //tab1->tlong[(i*7)+3];
1307 err=MEDfamEcr(fid,namelocal,familiesi,sizefamilies,MED_FACE,MED_TRIA3);
1308 if (err<0) cerr<<"Problem MEDfamEcr faces of all joints"<<endl;
1313 //examples of test of med files ( ... for me!)
1314 //../Salome_321/med_231_install/bin/medconforme exemple11.med
1315 //../Salome_321/hdf5-1.6.3/bin/h5dump exemple11.med
1316 //../Salome_321/med_231_install/bin/mdump exemple11.med