From bf4670be30204599ab3838c00811bf8352fb1063 Mon Sep 17 00:00:00 2001 From: cvw Date: Mon, 21 Mar 2011 15:14:26 +0000 Subject: [PATCH] only for med3 compile successful. test will come --- src/tepal2med/ghs3dprl_mesh_wrap.cxx | 198 ++++++++++++++---------- src/tepal2med/ghs3dprl_mesh_wrap.h | 61 ++++---- src/tepal2med/ghs3dprl_msg_parser.cxx | 38 ++--- src/tepal2med/tepal2med.cxx | 210 +++++++++++--------------- 4 files changed, 258 insertions(+), 249 deletions(-) diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index dd690c1..d6a96a1 100755 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -36,9 +36,16 @@ #include #include +#include + +extern "C" { +#include +//#include +//#include +//#include +} using namespace std; -using namespace med_2_2; //utils procedures @@ -102,8 +109,9 @@ void charendnull(char *p, QString deb, int lg) fend gb; fagr::iterator it1; fend::iterator it2; - //cout<<"\n***familles.write()***\n"; + int nbf=0,nbg=0; for (it1=fam.begin(); it1!=fam.end(); ++it1){ + nbf++; cout<<"Family=<"<<(*it1).first.toLatin1().constData()<<">\tGroups="; gb=(*it1).second; for (it2=gb.begin(); it2!=gb.end(); ++it2){ @@ -111,7 +119,9 @@ void charendnull(char *p, QString deb, int lg) } cout<\tFamilies="; gb=(*it1).second; for (it2=gb.begin(); it2!=gb.end(); ++it2){ @@ -119,6 +129,7 @@ void charendnull(char *p, QString deb, int lg) } cout<>subnumber; if (verbose>2) cout<<"NumberOfSubdomains="<>tmint[i]; + //tmint=new med_int[subnumber*3]; + tmint=new med_int[subnumber*3]; + long onelong,maxint; + maxint=std::numeric_limits::max(); + //pb from tepalv2 + bool isproblem=true; + for (int i=0; i>onelong; + //pb from tepalv2 + if (onelong<0) { + if (isproblem && verbose>1) cout<<"There is one or more negative med_int value in NumberOfSubdomains "<maxint) { + if (isproblem && verbose>1) cout<<"There is one or more truncated med_int value in NumberOfSubdomains "<4) cout<<"Subdomains "<0) fprintf(stdout,"Files write with MED V%d.%d.%d\n",majeur,mineur,release); node = xmlNewChild(root_node, 0, BAD_CAST "version",0); //xmlNewProp(node, BAD_CAST "maj", BAD_CAST int2string2(majeur).c_str()); @@ -1430,7 +1460,10 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) { bool ok=true,oktmp; QString tmp,cmd; - char description[MED_TAILLE_DESC]; + char description[MED_COMMENT_SIZE]; + char dtunit[MED_SNAME_SIZE+1]="_NO_UNIT"; + char axisname[MED_SNAME_SIZE*3+1]="x y z "; + char axisunit[MED_SNAME_SIZE*3+1]="_NO_UNIT _NO_UNIT _NO_UNIT "; med_int nb; //remove path @@ -1448,9 +1481,11 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) //create file resume DOMAIN.joints.med of all joints for quick display (...may be...) tmp=path+medname+tmp.sprintf("_joints.med",idom); - charendnull(distfilename,tmp,MED_TAILLE_DESC); - fidjoint=MEDouvrir(distfilename,MED_CREATION); - if (fidjoint<0) cerr<<"Problem MEDouvrir "<0) cout<<"CreateMEDFile for all joints <"<\n"; //copy file source/GHS3DPRL_skin.med as destination/DOMAIN.skin.med @@ -1526,11 +1561,11 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) if (idom>1) families=intermediatesfamilies; //if (idom>1) continue; tmp=path+medname+tmp.sprintf("_%d.med",idom); - charendnull(distfilename,tmp,MED_TAILLE_DESC); + charendnull(distfilename,tmp,MED_COMMENT_SIZE); //cout<<"<"<"<0){ if (verbose>2) cout<\n"; @@ -1538,13 +1573,13 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) //create mesh tmp=medname+tmp.sprintf("_%d",idom); - charendnull(nomfinal,tmp,MED_TAILLE_NOM); + charendnull(nomfinal,tmp,MED_NAME_SIZE); tmp=tmp.sprintf("domain %d among %d",idom,nbfilestot); - charendnull(description,tmp,MED_TAILLE_DESC); + charendnull(description,tmp,MED_COMMENT_SIZE); if (verbose>4) cout<<"Description : "<5)cout<<"NumberOfFamiliesNodes="<8) - cout<<"MEDfamEcr nodes "<5)cout<<"NumberOfFamiliesFacesAndEdgesEtc="<8) - cout<<"MEDfamEcr tria3 "<8) - cout<<"MEDfamEcr tetra4 "<0)cout<<"\nTotalNumberOftetrahedra="<remove_key_mesh_wrap(QRegExp(tmp,true,true)); xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp)); nbnodes=tab->size/3; - err=MEDcoordEcr(fid,nomfinal,3,tab->tmflo,MED_FULL_INTERLACE, - nbnodes,MED_CART,nomcoo,unicoo); - if (err<0) {cerr<<"Problem MEDcoordEcr"<tmflo); + if (err<0) {cerr<<"Problem MEDmeshNodeCoordinateWr"<4)cout<<"NumberOfNodes="<restore_key(key1); //tab1=this->mestab[key1]; @@ -1672,8 +1706,8 @@ bool ghs3dprl_mesh_wrap::idom_nodes() // tab3->tmflo[i*3+1],tab3->tmflo[i*3+2])<tmint,nbnodes,MED_NOEUD,MED_NONE); - if (err<0){cerr<<"Problem MEDglobalNumEcr nodes"<tmint); + if (err<0){cerr<<"Problem MEDmeshGlobalNumberWr nodes"<tmint[i+2]; ii++; i=i+7; } - err=MEDconnEcr(fid,nomfinal,3,arrayi,MED_FULL_INTERLACE,nbtria3,MED_MAILLE,MED_TRIA3,MED_NOD); + err=MEDmeshElementConnectivityWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,nbtria3,arrayi); delete[] arrayi; //need immediately more little array - if (err<0){cerr<<"Problem MEDconnEcr for triangles connectivity"< arrayi[i]=!NBFACES!+i+1 arrayi=new med_int[nbtria3]; for (i=0; i2) cout<<"CreateMEDglobalNumerotation_Faces "<size<tmint,tab1->size,MED_MAILLE,MED_TRIA3); - if (err<0){cerr<<"Problem MEDglobalNumEcr faces"<size,tab1->tmint); + if (err<0){cerr<<"Problem MEDmeshGlobalNumberWr faces"<remove_key_mesh_wrap(QRegExp("FC*",true,true)); tmp=tmp.sprintf("GL%d FA",idom); @@ -1871,14 +1905,17 @@ bool ghs3dprl_mesh_wrap::idom_joints() CVWtab *tab,*tab1,*tab2; med_int ineig,ii,jj,i,j,k,*arrayi,nb,famjoint,*fammore,*inodes,*arrayfaces; med_float *arraynodes; - char namejnt[MED_TAILLE_NOM+1]; //no more 32 - char namedist[MED_TAILLE_NOM+1]; - char descjnt[MED_TAILLE_DESC+1]; + char namejnt[MED_NAME_SIZE+1]; //no more 32 + char namedist[MED_NAME_SIZE+1]; + char descjnt[MED_COMMENT_SIZE+1]; med_int numfam_ini_wrap=100; joints_node=xmlNewNode(NULL, BAD_CAST "joints"); //masterfile.xml med_int nbjoints=0,nbnodesneig,nbtria3neig; string sjoints=""; //which domains are neighbourg int xx; + char dtunit[MED_SNAME_SIZE+1]="_NO_UNIT"; + char axisname[MED_SNAME_SIZE*3+1]="x y z "; + char axisunit[MED_SNAME_SIZE*3+1]="_NO_UNIT _NO_UNIT _NO_UNIT "; tmp=tmp.sprintf("MS%d *",idom); //read file .msg if not done @@ -1945,8 +1982,8 @@ bool ghs3dprl_mesh_wrap::idom_joints() strcpy(descjnt,tmp.toLatin1().constData()); tmp=medname+tmp.sprintf("_%d",ineig); strcpy(namedist,tmp.toLatin1().constData()); - err=MEDjointCr(fid,nomfinal,namejnt,descjnt,ineig,namedist); - if (err<0) cerr<<"Problem MEDjointCr"<0) { //for (i=0; isize/4; nbtetrastotal=nbtetrastotal + nbtetra4; if (verbose>5)cout<<"NumberOftetrahedra="<tmint,MED_FULL_INTERLACE,nbtetra4,MED_MAILLE,MED_TETRA4,MED_NOD); - if (err<0){cerr<<"Problem MEDconnEcr for tetra connectivity"<tmint); + if (err<0){cerr<<"Problem MEDmeshElementConnectivityWr for tetra connectivity"<2) cout<<"CreateMEDglobalNumerotation_tetrahedra "<size<tmint,tab1->size,MED_MAILLE,MED_TETRA4); - if (err<0){cerr<<"Problem MEDglobalNumEcr tetrahedra"<size,tab1->tmint); + if (err<0){cerr<<"Problem MEDmeshGlobalNumberWr tetrahedra"<remove_key_mesh_wrap(QRegExp(tmp,true,true)); @@ -2179,8 +2216,8 @@ med_int ghs3dprl_mesh_wrap::create_families(med_idt fid, int sign) //if sign >= 0 family zero and family nodes { med_int pas,ires; - char nomfam[MED_TAILLE_NOM+1]; //it.current()->name; - char attdes[MED_TAILLE_DESC+1]="_NO_DESCRIPTION"; + char nomfam[MED_NAME_SIZE+1]; //it.current()->name; + char attdes[MED_COMMENT_SIZE+1]="_NO_DESCRIPTION"; char *gro; med_int i,attide=1,attval=1,natt=1,num,ngro; @@ -2193,26 +2230,25 @@ med_int ghs3dprl_mesh_wrap::create_families(med_idt fid, int sign) num=(*it1).first.toLong(); if ((pas==-1) && (num>=0)) continue; //not good families if ((pas== 1) && (num< 0)) continue; //not good families - charendnull(nomfam,(*it1).first,MED_TAILLE_NOM); + charendnull(nomfam,(*it1).first,MED_NAME_SIZE); ires++; //med_int natt=0; ngro=(*it1).second.size(); if (verbose>5) cout<<"CreateFamilyInMEDFile <"<\tNbGroups="<5)cout<<" <"<<&gro[i*MED_TAILLE_LNOM]<<"> "; + charendnull(&gro[i*MED_LNAME_SIZE],(*it2).first,MED_LNAME_SIZE); + if (verbose>5)cout<<" <"<<&gro[i*MED_LNAME_SIZE]<<"> "; i++; } if (verbose>5)cout< //Med File V 2.2 attributes -#undef MED_H -#undef MED_PROTO_H -namespace med_2_2 { +//#undef MED_H +//#undef MED_PROTO_H + extern "C" { #include -#include +//#include } -} class CVWtab //contains size=size of vector and the vector (med_int or med_float) @@ -53,12 +52,12 @@ public: static long memoryuse; static long memorymax; long size,type; - med_2_2::med_int *tmint; //integer med - med_2_2::med_float *tmflo; //float med + med_int *tmint; //integer med + med_float *tmflo; //float med QString filename; - CVWtab(long nb, med_2_2::med_int *pmint); - CVWtab(long nb, med_2_2::med_float *pmflo); + CVWtab(long nb, med_int *pmint); + CVWtab(long nb, med_float *pmflo); ~CVWtab(); bool CVWtab_deallocate(); bool is_equal(CVWtab *tab2); @@ -78,9 +77,9 @@ class familles{ xmlNodePtr xml_groups(); void add(QString nomfam, QString nomgro); void addgro(); - bool get_number_of_new_family(int sign,med_2_2::med_int *num,QString *tmp); - med_2_2::med_int find_family_on_groups(med_2_2::med_int fam1, med_2_2::med_int fam2); - fend fuse_goups(med_2_2::med_int fam1, med_2_2::med_int fam2); + bool get_number_of_new_family(int sign,med_int *num,QString *tmp); + med_int find_family_on_groups(med_int fam1, med_int fam2); + fend fuse_goups(med_int fam1, med_int fam2); }; class ghs3dprl_mesh_wrap @@ -93,13 +92,13 @@ public: nofile,nbfiles,nbfilestot, nbelem_limit_swap, verbose; - med_2_2::med_err err; - med_2_2::med_idt fid,fidjoint; - med_2_2::med_int idom; + med_err err; + med_idt fid,fidjoint; + med_int idom; //master.xml std::string filemaster,domainname; - char distfilename[MED_TAILLE_DESC]; + char distfilename[MED_COMMENT_SIZE]; xmlDocPtr master_doc; xmlNodePtr root_node,node,node2, joints_node,info_node,files_node,mesh_node; @@ -108,20 +107,20 @@ public: familles families; //from skin.med - char nommaa[MED_TAILLE_NOM+1]; - char maillage_description[MED_TAILLE_DESC+1]; - char nomcoo[3*MED_TAILLE_PNOM+1]; - char unicoo[3*MED_TAILLE_PNOM+1]; - med_2_2::med_int *famnodesskin; //from skin.med... - med_2_2::med_int *famseg2skin; //...valid on global index/numerotation - med_2_2::med_int *famtria3skin; + char nommaa[MED_NAME_SIZE+1]; + char maillage_description[MED_COMMENT_SIZE+1]; + char nomcoo[3*MED_SNAME_SIZE+1]; + char unicoo[3*MED_SNAME_SIZE+1]; + med_int *famnodesskin; //from skin.med... + med_int *famseg2skin; //...valid on global index/numerotation + med_int *famtria3skin; //to final files .med with tetrahedra - char nomfinal[MED_TAILLE_NOM+1]; - med_2_2::med_int *famnodes,nbnodes,famnewnodes,famallnodes; //to final files .med with tetrahedra - med_2_2::med_int *famseg2,nbseg2,famnewseg2,famallseg2; - med_2_2::med_int *famtria3,nbtria3,famnewtria3,famalltria3; - med_2_2::med_int *famtetra4,nbtetra4,famnewtetra4,famalltetra4; + char nomfinal[MED_NAME_SIZE+1]; + med_int *famnodes,nbnodes,famnewnodes,famallnodes; //to final files .med with tetrahedra + med_int *famseg2,nbseg2,famnewseg2,famallseg2; + med_int *famtria3,nbtria3,famnewtria3,famalltria3; + med_int *famtetra4,nbtetra4,famnewtetra4,famalltetra4; //low level bool list_keys_mesh_wrap(); //list keys @@ -133,9 +132,9 @@ public: CVWtab* restore_key(const QString &key); //family level - bool set_one_more_family(med_2_2::med_int *fami, med_2_2::med_int *more, med_2_2::med_int nb); - med_2_2::med_int create_families(med_2_2::med_idt fid,int sign); - void add_family(med_2_2::med_int num,QString newgro); + bool set_one_more_family(med_int *fami, med_int *more, med_int nb); + med_int create_families(med_idt fid,int sign); + void add_family(med_int num,QString newgro); void cout_families_and_groups(); bool idom_nodes(); bool idom_edges(); diff --git a/src/tepal2med/ghs3dprl_msg_parser.cxx b/src/tepal2med/ghs3dprl_msg_parser.cxx index b790d97..e0cdfbc 100755 --- a/src/tepal2med/ghs3dprl_msg_parser.cxx +++ b/src/tepal2med/ghs3dprl_msg_parser.cxx @@ -54,9 +54,9 @@ bool ghs3dprl_msg_parser::startDocument() //************************************ bool ghs3dprl_msg_parser::startElement(const QString &namespaceURI, - const QString &localName, - const QString &qName, - const QXmlAttributes &attrs) + const QString &localName, + const QString &qName, + const QXmlAttributes &attrs) { bool ok; if (verbose) std::cout<nofile,neighbourindice)+ - shorttypel+shortsendreceive; + mailw->nofile,neighbourindice)+ + shorttypel+shortsendreceive; tmp=tmp.simplified(); ok=mailw->insert_key(tmp,montab); return true; diff --git a/src/tepal2med/tepal2med.cxx b/src/tepal2med/tepal2med.cxx index 5be0af2..a4b710b 100755 --- a/src/tepal2med/tepal2med.cxx +++ b/src/tepal2med/tepal2med.cxx @@ -29,11 +29,13 @@ #include /* printf clrscr fopen fread fwrite fclose */ #include #include +#include #include #include #include #include + #include #include #include @@ -49,11 +51,9 @@ extern "C" { //#include //#include //#include -#include } using namespace std; -using namespace med_2_2; //************************************ med_idt ouvre_fichier_MED(char *fichier,int verbose) @@ -67,27 +67,28 @@ med_idt ouvre_fichier_MED(char *fichier,int verbose) if (ret < 0) return fid; /* on regarde s'il s'agit d'un fichier au format HDF5 */ - ret = MEDformatConforme(fichier); + med_bool hdfok,medok; + ret = MEDfileCompatibility(fichier,&hdfok,&medok); if (ret < 0){ - cerr<<"File "<0)fprintf(stdout,"\nReading %s with MED V%d.%d.%d", fichier,majeur,mineur,release); /* Ouverture du fichier MED en lecture seule */ - fid = MEDouvrir(fichier,MED_LECTURE); + fid = MEDfileOpen(fichier,MED_ACC_RDONLY); if (ret < 0) return fid; - MEDversionLire(fid, &majeur, &mineur, &release); + MEDfileNumVersionRd(fid, &majeur, &mineur, &release); if (majeur < 2 || majeur == 2 && mineur < 2) { fprintf(stderr,"File %s from MED V%d.%d.%d not assumed\n", fichier,majeur,mineur,release); //" version est ant�ieure �la version 2.2"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); fid=0; } else { if (verbose>0)fprintf(stdout,", file from MED V%d.%d.%d\n",majeur,mineur,release); } @@ -100,75 +101,77 @@ bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) { med_err ret; med_idt fid=0; - med_int i,j,mdim,nmaa,edim,majeur_lu,mineur_lu,release_lu,nprofils; - med_maillage type_maillage; + med_int i,j,sdim,mdim,nmaa,edim,majeur_lu,mineur_lu,release_lu,nprofils,nstep; + med_mesh_type type_maillage; + char dtunit[MED_SNAME_SIZE+1]; + char axisname[MED_SNAME_SIZE+1]; + char axisunit[MED_SNAME_SIZE*3+1]; + med_sorting_type sortingtype; + med_axis_type axistype; int numero=1; - med_connectivite typ_con=MED_NOD; QString key,tmp; - + med_bool chan; + med_bool tran; + //version qt3 char chaine[nomfilemed.length()+1]; strncpy(chaine,nomfilemed.toLatin1().constData(),nomfilemed.length()+1); //cout<<"*** ReadFileMED *** "<verbose); if (fid == 0) { cerr<<"Problem opening file "< 1) cout<<"More than one mesh in "<nommaa,&mdim,&type_maillage, - mymailw->maillage_description); + ret = MEDmeshInfo(fid,numero,mymailw->nommaa,&sdim,&mdim,&type_maillage,mymailw->maillage_description, + dtunit,&sortingtype,&nstep,&axistype,axisname,axisunit); if (ret < 0){ - cerr<<"Problem MEDmaaInfo in "<nommaa); - if (!((edim == 3)||(edim == -1))){ - cerr<<"Problem dimension Espace should be 3 or -1: "<nommaa,MED_COOR,MED_NOEUD, - (med_geometrie_element)0,(med_connectivite)0); + //cf med-3.0.0_install/share/doc/html/maillage_utilisateur.html + med_int nnoe=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT, + MED_NODE,MED_NO_GEOTYPE,MED_COORDINATE,MED_NO_CMODE,&chan,&tran); + //(med_geometrie_element)0,(med_connectivite)0); if (nnoe<1){ cerr<<"Problem number of Vertices < 1\n"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); return false; } //nombre d'objets MED : mailles, faces, aretes , ... - med_int nmailles[MED_NBR_GEOMETRIE_MAILLE],nbtria3; - med_int nfaces[MED_NBR_GEOMETRIE_FACE]; - med_int naretes[MED_NBR_GEOMETRIE_ARETE],nbseg2; + med_int nmailles[MED_N_CELL_GEO],nbtria3; + med_int nfaces[MED_N_FACE_GEO]; + med_int naretes[MED_N_EDGE_FIXED_GEO],nbseg2; + //med_int nmailles[MED_NBR_GEOMETRIE_MAILLE],nbtria3; + //med_int nfaces[MED_NBR_GEOMETRIE_FACE]; + //med_int naretes[MED_NBR_GEOMETRIE_ARETE],nbseg2; //polygones et polyedres familles equivalences joints med_int nmpolygones,npolyedres,nfpolygones,nfam,nequ,njnt; @@ -178,16 +181,14 @@ bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) //lecture_nombre_mailles_standards(fid,nommaa,typmai[i],typ_con,i); if (mymailw->verbose>6) cout<<"NumberOf"<nommaa,MED_CONN,MED_MAILLE,MED_TRIA3,typ_con); - nbseg2=MEDnEntMaa(fid,mymailw->nommaa,MED_CONN,MED_MAILLE,MED_SEG2,typ_con); - - //Combien de mailles polygones quelconques ? - //nmpolygones = lecture_nombre_mailles_polygones(fid,nommaa,typ_con); - //Combien de mailles polyedres quelconques ? - //npolyedres = lecture_nombre_mailles_polyedres(fid,nommaa,typ_con); + + nbtria3=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_TRIA3,MED_CONNECTIVITY,MED_NODAL,&chan,&tran); + nbseg2=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_SEG2,MED_CONNECTIVITY,MED_NODAL,&chan,&tran); //combien de familles ? - nfam=MEDnFam(fid,mymailw->nommaa); + nfam=MEDnFamily(fid,mymailw->nommaa); if (mymailw->verbose>2) { cout<<"\nNumberOfFamilies="<nommaa,i+1); + ngro = MEDnFamilyGroup(fid,mymailw->nommaa,i+1); if (ngro < 0){ cerr<<"Problem reading number of groups of family\n"; continue; } - //nombre d'attributs - natt = MEDnAttribut(fid,mymailw->nommaa,i+1); - if (natt < 0){ - cerr<<"Problem reading number of attributes of family\n"; - continue; - } - - //nom,numero,attributs,groupes + //atributs obsolete MED3 //allocation memoire par exces - attide = (med_int*) malloc(sizeof(med_int)*(natt+1)); - attval = (med_int*) malloc(sizeof(med_int)*(natt+1)); - attdes = (char *) malloc(MED_TAILLE_DESC*(natt+1)); - gro = (char*) malloc(MED_TAILLE_LNOM*(ngro+1)); + gro = (char*) malloc(MED_LNAME_SIZE*(ngro+1)); - ret = MEDfamInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,attide,attval, - attdes,&natt,gro,&ngro); + ret = MEDfamilyInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,gro); if (ret < 0){ cerr<<"Problem reading informations of family\n"; continue; } if (mymailw->verbose>8) { - cout<<"Family "<deletegroups)>0) { //cout<<"idelete++ "<deletegroups)==0){ @@ -304,8 +286,8 @@ med_int famdelete[nfam],ifamdelete=0,idelete; } /*for (j=0;jdeletegroups)==0){ @@ -321,9 +303,6 @@ med_int famdelete[nfam],ifamdelete=0,idelete; }*/ //on libere la memoire - free(attide); - free(attval); - free(attdes); free(gro); } } @@ -334,29 +313,25 @@ if (mymailw->verbose>3){ cout<<"\nFamiliesAndGroupsOf "<families.write(); } - - med_repere rep; - med_mode_switch mode_coo=MED_FULL_INTERLACE; - /* Allocations memoires */ - /* table des coordonnees profil : (dimension * nombre de noeuds ) */ - med_float *coo=new med_float[nnoe*mdim]; + /* table des coordonnees profil : (space dimension * nombre de noeuds ) */ + med_float *coo=new med_float[nnoe*sdim]; /* table des numeros de familles des noeuds profil : (nombre de noeuds) */ med_int *famnodesskin=new med_int[nnoe]; med_int *pfltab=new med_int[1]; //inutilise car on lit tout //lecture des noeuds : coordonnees - ret=MEDcoordLire(fid,mymailw->nommaa,mdim,coo, - mode_coo,MED_ALL, - pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo); + ret=MEDmeshNodeCoordinateRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_FULL_INTERLACE,coo); + //mdim,coo,mode_coo,MED_ALL,pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo); if (ret < 0){ cerr<<"Problem reading nodes\n"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); //return false; } - ret=MEDfamLire(fid,mymailw->nommaa,famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0); + ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,famnodesskin); + //famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0); if (ret < 0){ cerr<<"Problem reading families of nodes\n"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); return false; } if (mymailw->verbose>9) { @@ -369,18 +344,20 @@ if (mymailw->verbose>3){ } med_int *conn2=new med_int[nbseg2*2]; - ret=MEDconnLire(fid,mymailw->nommaa,mdim,conn2,mode_coo, - pfltab,0,MED_MAILLE,MED_SEG2,MED_NOD); + ret=MEDmeshElementConnectivityRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_SEG2,MED_NODAL,MED_FULL_INTERLACE,conn2); + //mdim,conn2,mode_coo,pfltab,0,MED_MAILLE,MED_SEG2,MED_NOD); if (ret < 0){ cerr<<"Problem reading MED_SEG2\n"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); //return false; } med_int *famseg2skin=new med_int[nbseg2]; - ret=MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2); + ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_SEG2,famseg2skin); + //MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2); if (ret < 0){ cerr<<"Problem reading families of MED_SEG2\n"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); return false; } if (mymailw->verbose>9) { @@ -393,18 +370,20 @@ if (mymailw->verbose>3){ } med_int *conn3=new med_int[nbtria3*3]; - ret=MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo, - pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD); + ret=MEDmeshElementConnectivityRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT, + MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,pfltab); + //MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo,pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD); if (ret < 0){ cerr<<"Problem reading MED_TRIA3\n"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); //return false; } med_int *famtria3skin=new med_int[nbtria3]; - ret=MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3); + ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,famtria3skin); + //MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3); if (ret < 0){ cerr<<"Problem reading families of MED_TRIA3\n"; - ret = MEDfermer(fid); + ret = MEDfileClose(fid); return false; } if (mymailw->verbose>9) { @@ -472,7 +451,7 @@ if (mymailw->verbose>3){ //if (mymailw->verbose>6) ok=mymailw->list_keys_mesh_wrap(); - ret = MEDfermer(fid); + ret = MEDfileClose(fid); if (ret < 0){ cerr<<"Problem closing "<