From 43c779384514ea89cc84fc8b9aad70d56ffbd9dc Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 13 Aug 2009 05:17:24 +0000 Subject: [PATCH] Porting to gcc 4.3 --- src/tepal2med/ghs3dprl_mesh_wrap.cxx | 772 +++++++++++++------------- src/tepal2med/ghs3dprl_mesh_wrap.h | 52 +- src/tepal2med/ghs3dprl_msg_parser.cxx | 8 +- src/tepal2med/tepal2med.cxx | 343 ++++++------ 4 files changed, 582 insertions(+), 593 deletions(-) diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index a3ffdff..d6c4186 100755 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -25,7 +25,6 @@ #include "ghs3dprl_mesh_wrap.h" -#include #include #include #include @@ -38,22 +37,19 @@ #include #include -using namespace std; -using namespace med_2_2; - //utils procedures //************************************ -string i2a(const int &v) +std::string i2a(const int &v) { - ostringstream ss; + std::ostringstream ss; ss<\tGroups="; + std::cout<<"Family=<"<<(*it1).first.toLatin1().constData()<<">\tGroups="; gb=(*it1).second; for (it2=gb.begin(); it2!=gb.end(); ++it2){ - cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; + std::cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; } - cout<\tFamilies="; + std::cout<<"Group=<"<<(*it1).first.toLatin1().constData()<<">\tFamilies="; gb=(*it1).second; for (it2=gb.begin(); it2!=gb.end(); ++it2){ - cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; + std::cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; } - cout<\t<"<\n"; + //std::cout<<"add family <"<\t<"<\n"; fagr::iterator it; it=fam.find(nomfam); if (it==fam.end()){ - //cout<<"add new family <"<\t<"<\n"; + //std::cout<<"add new family <"<\t<"<\n"; newfam(nomfam); it=fam.find(nomfam); } @@ -165,7 +161,7 @@ void charendnull(char *p, QString deb, int lg) (*it).second[nomgro]=0; it=gro.find(nomgro); if (it==gro.end()){ - //cout<<"***new*** "<= 0 family zero and family nodes //outputs in *ires and *tmp @@ -191,19 +187,19 @@ bool familles::get_number_of_new_family(int sign, med_int *ires, QString *tmp) it=fam.find(nomfam); if (it==fam.end()) { *tmp=nomfam; *ires=ii; - //cout<<"NewFamily Found<"<<*ires<<"><"<<*tmp<<">\n"; + //std::cout<<"NewFamily Found<"<<*ires<<"><"<<*tmp<<">\n"; return true; } ii=ii+pas; } - cerr<<"***get_number_of_new_family*** Problem new family not found"< from <"<< + //std::cout<<"find_family_on_groups old <"< from <"<< // fam1<<"><"<\n"; return ires; } } - //cout<<"no family found!!! - groups of "<add(tmp,(*it).first); } - //cout<<"new family <"< intersection of <"<<"<\n"; + //std::cout<<"new family <"< intersection of <"<<"<\n"; return ires; } //************************************ - fend familles::fuse_goups(med_int fam1, med_int fam2) + fend familles::fuse_goups(med_2_2::med_int fam1, med_2_2::med_int fam2) //concatenation/fusion deux map groupes { QString nom1,nom2; @@ -241,7 +237,7 @@ bool familles::get_number_of_new_family(int sign, med_int *ires, QString *tmp) nom2=nom2.sprintf("%d",fam2); it2=fam.find(nom2); if ( (it1==fam.end())||(it2==fam.end()) ) { - cerr<<"***fuse_goups*** non existing family "< "; + std::cout<<"<"<<(*it).first.toLatin1().constData()<<"> "; } - cout<memorymax) { - cout<<"***WARNING*** memory max reached "<memorymax) { - cout<<"***WARNING*** memory max reached "<filename<filename<CVWtab_deallocate(); //remove temporary file if (this->filename!="_NO_FILE") { remove(this->filename.toLatin1().constData()); //#include - //cout<filename<<" successfully deleted\n"; + //std::cout<filename<<" successfully deleted\n"; } } @@ -313,37 +309,37 @@ CVWtab::~CVWtab() //************************************ bool CVWtab::CVWtab_deallocate() { - //cout<<" deallocate CVWtab*** "<size<type==1) cout<<"med_int tab1[0]="<tmint[0]<type==2) cout<<"med_float tab1[0]="<tmflo[0]<size<type==1) std::cout<<"med_2_2::med_int tab1[0]="<tmint[0]<type==2) std::cout<<"med_2_2::med_float tab1[0]="<tmflo[0]<size!=tab2->size) return false; if (this->type!=tab2->type) return false; if (this->type==1) { if (!this->tmint) - { cout<<"***is_equal*** pb pointer NULL with tmint size="<size<size<size<=tab1->size) { - cerr<<"BadIndice tab1 in is_equal_vertices "<< - di1<<" not in "<size<size<=tab2->size) { - cerr<<"BadIndice tab2 in is_equal_vertices "<< - di2<<" not in "<size<size<tmflo+di1); @@ -399,11 +395,11 @@ bool CVW_is_equal_vertices(CVWtab *tab1, long i1, } //************************************ -bool CVW_FindString(const string &str,fstream &Ff, long &count) +bool CVW_FindString(const std::string &str,std::fstream &Ff, long &count) //find in file first line with string str in first position of line //converts count value expected after "='" in line found { - string line; + std::string line; QString tmp; do { @@ -422,7 +418,7 @@ bool CVW_FindString(const string &str,fstream &Ff, long &count) } else { - cerr<<"Problem line '"< for speed (and so no test) { QString tmp; - fstream Ff(FileName.toLatin1().constData(),ios_base::in); - string line; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + std::string line; long i,count,nbneighbour,ineighbour; bool ok; if (!Ff.is_open()) { - cerr<<"Problem File '"<4) std::cout<<"Vertices "<nofile,ineighbour); @@ -464,9 +460,9 @@ bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName) } if (!CVW_FindString("4) std::cout<<"Edges "<nofile,ineighbour); @@ -474,9 +470,9 @@ bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName) } if (!CVW_FindString("4) std::cout<<"Faces "<nofile,ineighbour); @@ -484,9 +480,9 @@ bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName) } if (!CVW_FindString("4) std::cout<<"Elements "<nofile,ineighbour); @@ -505,25 +501,25 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) //read file .glo with no parser xml because big file (volume) { QString tmp; - fstream Ff(FileName.toLatin1().constData(),ios_base::in); - string line; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + std::string line; long count; bool ok; if (!Ff.is_open()) { - cerr<<"Problem File '"<4) std::cout<<"Elements "<nofile); @@ -531,12 +527,12 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) } if (!CVW_FindString("4) std::cout<<"Elements "<nofile); @@ -544,12 +540,12 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) } if (!CVW_FindString("4) std::cout<<"Elements "<nofile); @@ -557,12 +553,12 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) } if (!CVW_FindString("4) std::cout<<"Elements "<nofile); @@ -579,14 +575,14 @@ bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName) //read file .faces (wrap) { QString tmp; - fstream Ff(FileName.toLatin1().constData(),ios_base::in); - string line; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + std::string line; long nbelem,ntype; bool ok; if (!Ff.is_open()) { - cerr<<"Problem File '"<3) cout<<"FacesNumberOfElements="<3) std::cout<<"FacesNumberOfElements="<>ntype; if (ntype!=3) //only triangles { - cerr<<"Problem on ntype != 3"<>tmint[i+j]; - //for (int j=0; j<7; j++) cout<4) cout<<"Elements "<4) std::cout<<"Elements "<nofile); @@ -633,46 +629,46 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITE(const QString FileName) //(parameter option of ghs3d but NOT tepal) { QString tmp; - fstream Ff(FileName.toLatin1().constData(),ios_base::in); + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); long ne,np,npfixe,subnumber,reste; bool ok; if (!Ff.is_open()){ - cerr<<"Problem File '"<>ne>>np>>npfixe; if (verbose>3){ - cout<<"NoboiteNumberOfElements="<>tmint[i]; - if (verbose>4) cout<<"Elements "<4) std::cout<<"Elements "<nofile); ok=this->insert_key(tmp,montab); - med_float *tmflo=new med_float[np*3]; + med_2_2::med_float *tmflo=new med_2_2::med_float[np*3]; for (int i=0; i>tmflo[i]; - if (verbose>4) cout<<"Vertices "<4) std::cout<<"Vertices "<nofile); ok=this->insert_key(tmp,montab); Ff>>subnumber; - if (verbose>2) cout<<"NumberOfSubdomains="<2) std::cout<<"NumberOfSubdomains="<>tmint[i]; - if (verbose>4) cout<<"Subdomains "<4) std::cout<<"Subdomains "<nofile); @@ -698,7 +694,7 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITEB(const QString FileName) { bool ok; QString tmp; - cerr<<"Problem function ReadFileNOBOITEB\n" + std::cerr<<"Problem function ReadFileNOBOITEB\n" <<"(no FORTRAN binary format files in tepal)\n\n"; //file binary FILE *Ff=fopen(FileName.toLatin1().constData(),"rb"); @@ -709,43 +705,43 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITEB(const QString FileName) //=> 2*long(68) (68=17*4octets) long r1[17+2]; if (!Ff){ - cerr<<"Problem File '"<3){ - cout<<"NoboitebNumberOfElements="<4) std::cout<<"Elements "<nofile); ok=this->insert_key(tmp,montab); fread(&reste,sizeof(long),1,Ff); - //cout<<"info "<2) cout<<"NumberOfSubdomains="<2) std::cout<<"NumberOfSubdomains="<4) printf("Subdomains %ld %ld ... %ld \n",tlong[0],tlong[1],tlong[subnumber*3-1]); - tmint=new med_int[subnumber*3]; + tmint=new med_2_2::med_int[subnumber*3]; for (long i=0; i2) cout<<"NumberOfVertices="<2) std::cout<<"NumberOfVertices="< size="<size< size="<size<verbose>6) cout<<"remove key "<verbose>6) std::cout<<"remove key "< it(this->mestab); while ( it.hasNext() ){ it.next(); if (it.key().contains(rxp)) nbremove++; } - //cout<<"nb_key_mesh_wrap found "<tmint){ if (verbose>3) - cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< + std::cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< " NbElements "<tmint,sizeof(med_int),taille,fichier); + " SizeElement_med_2_2::med_int "<tmint,sizeof(med_2_2::med_int),taille,fichier); //fread(&gagnants,sizeof(gagnants),1,fichier); } if (tab->tmflo){ if (verbose>3) - cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< + std::cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< " NbElements "<tmflo,sizeof(med_float),taille,fichier); + " SizeElement_med_2_2::med_float "<tmflo,sizeof(med_2_2::med_float),taille,fichier); } fclose(fichier); } else{ - if (verbose>3) cout<<"SwapOnFile in binary file done yet "<< - tab->filename.toLatin1().constData()<3) std::cout<<"SwapOnFile in binary file done yet "<< + tab->filename.toLatin1().constData()<CVWtab_deallocate(); //free memory @@ -956,9 +952,9 @@ long ghs3dprl_mesh_wrap::SwapOutOfMemory_key_mesh_wrap(const QRegExp &rxp, nb++; if ((it.value()->size>0)&&(it.value()->size>ifgreaterthan)){ if (verbose>3) - cout<<"SwapOutOfMemory_key_mesh_wrap on demand "<< + std::cout<<"SwapOutOfMemory_key_mesh_wrap on demand "<< it.key().toLatin1().constData()<< - " size "<size<<">"<size<<">"<path,it.value(),this->verbose); } @@ -971,17 +967,17 @@ bool ghs3dprl_mesh_wrap::list_onekey_mesh_wrap(const QString &key) { CVWtab *montab=this->mestab[key]; if (montab){ - //cout<<"key "< size="<size< size="<size<type==1) for ( long i=0; isize; i++ ) - cout<tmint[i]<<" "; + std::cout<tmint[i]<<" "; if (montab->type==2) for ( long i=0; isize; i++ ) - cout<tmflo[i]<<" "; - cout<tmflo[i]<<" "; + std::cout<4) - cout<<"insert key "<nbelem_limit_swapsize) { - if (verbose>3) cout<<"insert key automatic SwapOnFile "<< - key.toLatin1().constData()<3) std::cout<<"insert key automatic SwapOnFile "<< + key.toLatin1().constData()<path,tab,this->verbose); } this->mestab.insert(key,tab); @@ -1013,58 +1009,58 @@ CVWtab* ghs3dprl_mesh_wrap::restore_key(const QString &key) { CVWtab *tab=NULL; tab=this->mestab[key]; - /*if (tab) cout<<" -> size in proc "<size< tab NULL\n";*/ + /*if (tab) std::cout<<" -> size in proc "<size< tab NULL\n";*/ if (!tab) //it is NOT a problem { - if (verbose>6) cout<<"restore key not found "<6) std::cout<<"restore key not found "<size > 0){ - if (verbose>5) cout<<"restore key direct from memory "<filename.toLatin1().constData()<< - " type unexpexted "<type<filename.toLatin1().constData()<< + " type unexpexted "<type<filename<filename<filename.toLatin1().constData(),"rb"); long taille; fread(&taille,sizeof(long),1,fichier); if (taille!=-tab->size){ - cerr<<"Problem restore_key from binary file "<filename.toLatin1().constData()<< - " size unexpexted "<size<filename.toLatin1().constData()<< + " size unexpexted "<size<type==1){ if (verbose>5) - cout<<"restore key from binary file "<filename.toLatin1().constData()<< + std::cout<<"restore key from binary file "<filename.toLatin1().constData()<< " number of elements "<tmint=new med_int[taille]; //allocate memory - fread(tab->tmint,sizeof(med_int),taille,fichier); + tab->tmint=new med_2_2::med_int[taille]; //allocate memory + fread(tab->tmint,sizeof(med_2_2::med_int),taille,fichier); } if (tab->type==2){ if (verbose>5) - cout<<"restore key from binary file "<filename.toLatin1().constData()<< + std::cout<<"restore key from binary file "<filename.toLatin1().constData()<< " number of elements "<tmflo=new med_float[taille]; //allocate memory + tab->tmflo=new med_2_2::med_float[taille]; //allocate memory for (int i=0; itmflo[i]=-1e0; - fread(tab->tmflo,sizeof(med_float),taille,fichier); - /*for (int i=0; itmflo[i]<<"/"; - cout<tmflo,sizeof(med_2_2::med_float),taille,fichier); + /*for (int i=0; itmflo[i]<<"/"; + std::cout<size=-tab->size; @@ -1088,26 +1084,26 @@ bool ghs3dprl_mesh_wrap::test_msg_wrap() if (ifile==ineig) continue; //impossible key1=key1.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" SE"; key2=key2.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" RE"; - //cout<<"key "<restore_key(key1); //tab1=this->mestab[key1]; tab2=this->restore_key(key2); //tab2=this->mestab[key2]; - //cout<<"sortie key "<is_equal(tab2)) - { cout<<"key "<restore_key(key2); //tab2=this->mestab[key2]; if (!tab1 && !tab2) continue; //case not neighbours if (!tab1) - { cout<<"key "<type!=tab2->type)||(tab1->size!=tab2->size)) - { cout<<"key "<size!=tab2->size) { - cerr<<"TestEqualityCoordinates key "<2)&&(ok1)) - cout<<"TestEqualityCoordinates "<size<< - " Vertices "<size<< + " Vertices "<size<< - " Vertices "<size<< + " Vertices "<restore_key(QString("SKIN_VERTICES_COORDINATES")); - if (verbose>4)cout<<"NumberVerticesSKIN="<size/3<4)std::cout<<"NumberVerticesSKIN="<size/3<nbfiles; ifile++) @@ -1264,22 +1260,22 @@ bool ghs3dprl_mesh_wrap::Find_VerticesDomainToVerticesSkin() key2=key2.sprintf("GL%ld VE",ifile); glodom=this->restore_key(key2); if (verbose>4) - cout<<"NumberVerticesDOMAIN_"<size<size]; + med_2_2::med_int *tab=new med_2_2::med_int[glodom->size]; i=0; nb=0; //nb equals vertices if (verbose>8){ - cout<<"\nglobal numbering nodes: no iglo\n"; + std::cout<<"\nglobal numbering nodes: no iglo\n"; for (jd=0; jd < glodom->size; jd++) - cout<<"\t"<tmint[jd]<tmint[jd]<size; jd=jd+3) { p2=(coodom->tmflo+jd); @@ -1290,8 +1286,8 @@ bool ghs3dprl_mesh_wrap::Find_VerticesDomainToVerticesSkin() p1=(cooskin->tmflo+js); if (p1[0]==p2[0] && p1[1]==p2[1] && p1[2]==p2[2]) { - cout<<"\t"<tmint[i]-1<< - key2.sprintf("\t%13.5e%13.5e%13.5e",p1[0],p1[1],p1[2]).toLatin1().constData()<tmint[i]-1<< + key2.sprintf("\t%13.5e%13.5e%13.5e",p1[0],p1[1],p1[2]).toLatin1().constData()<insert_key(tmp,montab); if (verbose>4){ - cout<<"NumberOfEqualsVerticesDOMAIN_"<med_nomfinal no more 32 character //if path, in this->path. //20 preserve for add postfixes "_idom" etc... - if (verbose>0)cout<<"\nWrite_MEDfiles_v2\n"; - if (verbose>6){cout<<"\nInitialFamilies\n"; families.write();} + if (verbose>0)std::cout<<"\nWrite_MEDfiles_v2\n"; + if (verbose>6){std::cout<<"\nInitialFamilies\n"; families.write();} medname=medname.section('/',-1); if (medname.length()>20) { - cerr<<"CaseNameMed truncated (no more 20 characters)"<0) cout<<"CreateMEDFile for all joints <"<\n"; + fidjoint=med_2_2::MEDouvrir(distfilename,med_2_2::MED_CREATION); + if (fidjoint<0) std::cerr<<"Problem MEDouvrir "<0) std::cout<<"CreateMEDFile for all joints <"<\n"; //copy file source/GHS3DPRL_skin.med as destination/DOMAIN.skin.med tmp=path+medname+"_skin.med"; cmd="cp "+pathini+casename+"_skin.med "+tmp; - //cout<<"Copy skin.med Command = "<\n"; + if (verbose>0)std::cout<<"CreateMEDFile for initial skin <"<\n"; //define family 0 if not existing, no groups families.add("0",""); @@ -1469,45 +1465,45 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) oktmp=families.get_number_of_new_family(1,&famallnodes,&tmp); families.add(tmp,"All_Nodes"); } - else if (verbose>3) cout<<"--deletegroups matches \"All_Nodes\"\n"; + else if (verbose>3) std::cout<<"--deletegroups matches \"All_Nodes\"\n"; famalltria3=0; if (QString("All_Faces").contains(deletegroups)==0){ oktmp=families.get_number_of_new_family(-1,&famalltria3,&tmp); families.add(tmp,"All_Faces"); } - else if (verbose>3) cout<<"--deletegroups matches \"All_Faces\"\n"; + else if (verbose>3) std::cout<<"--deletegroups matches \"All_Faces\"\n"; famalltetra4=0; if (QString("All_Tetrahedra").contains(deletegroups)==0){ oktmp=families.get_number_of_new_family(-1,&famalltetra4,&tmp); families.add(tmp,"All_Tetrahedra"); } - else if (verbose>3) cout<<"--deletegroups matches \"All_Tetrahedra\"\n"; + else if (verbose>3) std::cout<<"--deletegroups matches \"All_Tetrahedra\"\n"; famnewnodes=0; if (QString("New_Nodes").contains(deletegroups)==0){ oktmp=families.get_number_of_new_family(1,&famnewnodes,&tmp); families.add(tmp,"New_Nodes"); } - else if (verbose>3) cout<<"--deletegroups matches \"New_Nodes\"\n"; + else if (verbose>3) std::cout<<"--deletegroups matches \"New_Nodes\"\n"; famnewtria3=0; if (QString("New_Faces").contains(deletegroups)==0){ oktmp=families.get_number_of_new_family(-1,&famnewtria3,&tmp); families.add(tmp,"New_Faces"); } - else if (verbose>3) cout<<"--deletegroups matches \"New_Faces\"\n"; + else if (verbose>3) std::cout<<"--deletegroups matches \"New_Faces\"\n"; famnewtetra4=0; if (QString("New_Tetrahedra").contains(deletegroups)==0){ oktmp=families.get_number_of_new_family(-1,&famnewtetra4,&tmp); families.add(tmp,"New_Tetrahedra"); } - else if (verbose>3) cout<<"--deletegroups matches \"New_Tetrahedra\"\n"; + else if (verbose>3) std::cout<<"--deletegroups matches \"New_Tetrahedra\"\n"; - if (verbose>6){cout<<"\nIntermediatesFamilies\n"; families.write();} - if (verbose>6) cout<<"\nNumber0fFiles="<6){std::cout<<"\nIntermediatesFamilies\n"; families.write();} + if (verbose>6) std::cout<<"\nNumber0fFiles="<"<"<0){ - if (verbose>2) cout<\n"; + if (verbose>2) std::cout<\n"; } //create mesh @@ -1537,58 +1533,58 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) tmp=tmp.sprintf("domain %d among %d",idom,nbfilestot); charendnull(description,tmp,MED_TAILLE_DESC); - if (verbose>4) cout<<"Description : "<4) std::cout<<"Description : "<6){cout<<"\nFinalsFamilies\n"; families.write();} + if (verbose>6){std::cout<<"\nFinalsFamilies\n"; families.write();} //for nodes families nb=create_families(fid,1); - if (verbose>5)cout<<"NumberOfFamiliesNodes="<5)std::cout<<"NumberOfFamiliesNodes="<8) - cout<<"MEDfamEcr nodes "<5)cout<<"NumberOfFamiliesFacesAndEdgesEtc="<5)std::cout<<"NumberOfFamiliesFacesAndEdgesEtc="<8) - cout<<"MEDfamEcr tria3 "<8) - cout<<"MEDfamEcr tetra4 "<0)cout<<"\nTotalNumberOftetrahedra="<0)std::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"<4)cout<<"NumberOfNodes="<tmflo,med_2_2::MED_FULL_INTERLACE, + nbnodes,med_2_2::MED_CART,nomcoo,unicoo); + if (err<0) {std::cerr<<"Problem MEDcoordEcr"<4)std::cout<<"NumberOfNodes="<restore_key(key1); //tab1=this->mestab[key1]; if (!tab1) { tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo"; ok=this->ReadFileGLO(tmp); - if (!ok) {cerr<<"Problem file "<restore_key(key1); //tab1=this->mestab[key1]; if (!tab1) return false; } - if (nbnodes!=tab1->size){cerr<<"Problem size GLi VE!=nbnodes!"<size){std::cerr<<"Problem size GLi VE!=nbnodes!"<restore_key(key2); //tab1=this->mestab[key1]; - med_int nbskin=tab2->size; - //for (i=0; itmint[i]<size; + //for (i=0; itmint[i]<tmint[j]<< + //std::cout<<"nodes loc "<tmint[j]<< // tmp.sprintf("\t%23.15e%23.15e%23.15e",tab3->tmflo[i*3], - // tab3->tmflo[i*3+1],tab3->tmflo[i*3+2])<tmflo[i*3+1],tab3->tmflo[i*3+2])<tmint,nbnodes,MED_NOEUD,MED_NONE); - if (err<0){cerr<<"Problem MEDglobalNumEcr nodes"<tmint,nbnodes,med_2_2::MED_NOEUD,med_2_2::MED_NONE); + if (err<0){std::cerr<<"Problem MEDglobalNumEcr nodes"< newfam "< newfam "<300) cout<< - "***set_one_more_family*** warning many initial families could decrease speed "<300) std::cout<< + "***set_one_more_family*** warning many initial families could decrease speed "< newfam "< newfam "<=0) newfami[ii]=newfam; } /*else { - cout<<"!!! oldfam "< newfam "< newfam "<size/7; - if (verbose>4) cout<<"NumberOfTriangles="<4) std::cout<<"NumberOfTriangles="<tmint[i]; ii++; @@ -1799,34 +1795,34 @@ bool ghs3dprl_mesh_wrap::idom_faces() arrayi[ii]=tab1->tmint[i+2]; ii++; i=i+7; } - err=MEDconnEcr(fid,nomfinal,3,arrayi,MED_FULL_INTERLACE,nbtria3,MED_MAILLE,MED_TRIA3,MED_NOD); + err=med_2_2::MEDconnEcr(fid,nomfinal,3,arrayi,med_2_2::MED_FULL_INTERLACE,nbtria3,med_2_2::MED_MAILLE,med_2_2::MED_TRIA3,med_2_2::MED_NOD); 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]; + arrayi=new med_2_2::med_int[nbtria3]; for (i=0; irestore_key(key1); //tab1=this->mestab[key1]; - if (nbtria3!=tab1->size){cerr<<"Problem size GLi FA!=nbtria3!"<size){std::cerr<<"Problem size GLi FA!=nbtria3!"<restore_key(key2); //tab1=this->mestab[key1]; - med_int nbskin=tab2->size; + med_2_2::med_int nbskin=tab2->size; //set families of faces existing in GHS3DPRL_skin.med - med_int nb=nbtria3; - famtria3=new med_int[nb]; + med_2_2::med_int nb=nbtria3; + famtria3=new med_2_2::med_int[nb]; for (i=0; i2) - // cout<<"CreateMEDglobalNumerotation_Faces "<size<tmint,tab1->size,MED_MAILLE,MED_TRIA3); - if (err<0){cerr<<"Problem MEDglobalNumEcr faces"<size<tmint,tab1->size,med_2_2::MED_MAILLE,med_2_2::MED_TRIA3); + if (err<0){std::cerr<<"Problem MEDglobalNumEcr faces"<remove_key_mesh_wrap(QRegExp("FC*",true,true)); tmp=tmp.sprintf("GL%d FA",idom); @@ -1862,15 +1858,15 @@ bool ghs3dprl_mesh_wrap::idom_joints() bool ok=true; QString tmp,namejoint,key,key1,key2; CVWtab *tab,*tab1,*tab2; - med_int ineig,ii,jj,i,j,k,*arrayi,nb,famjoint,*fammore,*inodes,*arrayfaces; - med_float *arraynodes; + med_2_2::med_int ineig,ii,jj,i,j,k,*arrayi,nb,famjoint,*fammore,*inodes,*arrayfaces; + med_2_2::med_float *arraynodes; char namejnt[MED_TAILLE_NOM+1]; //no more 32 char namedist[MED_TAILLE_NOM+1]; char descjnt[MED_TAILLE_DESC+1]; - med_int numfam_ini_wrap=100; + med_2_2::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 + med_2_2::med_int nbjoints=0,nbnodesneig,nbtria3neig; + std::string sjoints=""; //which domains are neighbourg int xx; tmp=tmp.sprintf("MS%d *",idom); @@ -1891,7 +1887,7 @@ bool ghs3dprl_mesh_wrap::idom_joints() tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".msg"; ok=this->ReadFileMSGnew(tmp); if (!ok) { - cerr<<"Problem in file "<no joints key1=key1.sprintf("MS%d NE%d VE RE",idom,ineig); //SE or RE tab2=tab1; //tab2=this->restore_key(key1); //no need because equals - if (!tab2) cerr<<"Problem nodes joint with no in file .msg"< with no in file .msg"<size; nbnodesneig=nb; nbjoints++; //one more joint for this domain sjoints=sjoints+" "+i2a(ineig); if (verbose>4) - cout<<"NumberOfNodesOfJoint_"<restore_key(key1); //tab1=this->mestab[key1]; if (!tab1){ if (verbose>4) - cout<<"NumberOfTrianglesOfJoint_"<no joints } else //have to set xml may be no faces but nodes in a joint! { key1=key1.sprintf("MS%d NE%d FA RE",idom,ineig); //SE or RE? tab2=tab1; //tab2=this->restore_key(key1); //no need because equals - if (!tab2) cerr<<"Problem triangles joint send with no receive"<restore_key(key); //tab1=this->mestab[key1]; - med_int nb=tab1->size; nbtria3neig=nb; + med_2_2::med_int nb=tab1->size; nbtria3neig=nb; if (verbose>4) - cout<<"NumberOfTrianglesOfJoint_"<0) { - //for (i=0; irestore_key(key1); //tab1=this->mestab[key1]; nbtetra4=tab1->size/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"<5)std::cout<<"NumberOftetrahedra="<tmint,med_2_2::MED_FULL_INTERLACE,nbtetra4,med_2_2::MED_MAILLE,med_2_2::MED_TETRA4,med_2_2::MED_NOD); + if (err<0){std::cerr<<"Problem MEDconnEcr for tetra connectivity"<size!=nbtetra4){ - cerr<<"Problem incorrect size of tetrahedra global numbering"<2) - cout<<"CreateMEDglobalNumerotation_tetrahedra "<size<tmint,tab1->size,MED_MAILLE,MED_TETRA4); - if (err<0){cerr<<"Problem MEDglobalNumEcr tetrahedra"<size<tmint,tab1->size,med_2_2::MED_MAILLE,med_2_2::MED_TETRA4); + if (err<0){std::cerr<<"Problem MEDglobalNumEcr tetrahedra"<remove_key_mesh_wrap(QRegExp(tmp,true,true)); @@ -2133,15 +2129,15 @@ bool ghs3dprl_mesh_wrap::idom_tetras() } //************************************ -med_int ghs3dprl_mesh_wrap::create_families(med_idt fid, int sign) +med_2_2::med_int ghs3dprl_mesh_wrap::create_families(med_2_2::med_idt fid, int sign) //if sign < 0 families faces or tria3 etc... //if sign >= 0 family zero and family nodes { - med_int pas,ires; + med_2_2::med_int pas,ires; char nomfam[MED_TAILLE_NOM+1]; //it.current()->name; char attdes[MED_TAILLE_DESC+1]="_NO_DESCRIPTION"; char *gro; - med_int i,attide=1,attval=1,natt=1,num,ngro; + med_2_2::med_int i,attide=1,attval=1,natt=1,num,ngro; if (sign>=0) pas=1; else pas=-1; ires=0; @@ -2154,24 +2150,24 @@ med_int ghs3dprl_mesh_wrap::create_families(med_idt fid, int sign) if ((pas== 1) && (num< 0)) continue; //not good families charendnull(nomfam,(*it1).first,MED_TAILLE_NOM); ires++; - //med_int natt=0; + //med_2_2::med_int natt=0; ngro=(*it1).second.size(); if (verbose>5) - cout<<"CreateFamilyInMEDFile <"<\tNbGroups="<\tNbGroups="<5)cout<<" <"<<&gro[i*MED_TAILLE_LNOM]<<"> "; + if (verbose>5)std::cout<<" <"<<&gro[i*MED_TAILLE_LNOM]<<"> "; i++; } - if (verbose>5)cout<5)std::cout< +#include #include +#include #include //Med File V 2.2 attributes @@ -45,9 +46,6 @@ namespace med_2_2 { #include #include -using namespace std; -using namespace med_2_2; - class CVWtab //contains size=size of vector and the vector (med_int or med_float) { @@ -56,19 +54,19 @@ public: static long memoryuse; static long memorymax; long size,type; - med_int *tmint; //integer med - med_float *tmflo; //float med + med_2_2::med_int *tmint; //integer med + med_2_2::med_float *tmflo; //float med QString filename; - CVWtab(long nb, med_int *pmint); - CVWtab(long nb, med_float *pmflo); + CVWtab(long nb, med_2_2::med_int *pmint); + CVWtab(long nb, med_2_2::med_float *pmflo); ~CVWtab(); bool CVWtab_deallocate(); bool is_equal(CVWtab *tab2); }; -typedef map fend; -typedef map fagr; +typedef std::map fend; +typedef std::map fagr; class familles{ private: void newfam(QString nom); @@ -81,9 +79,9 @@ class familles{ xmlNodePtr xml_groups(); void add(QString nomfam, QString nomgro); void addgro(); - 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); + 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); }; class ghs3dprl_mesh_wrap @@ -96,12 +94,12 @@ public: nofile,nbfiles,nbfilestot, nbelem_limit_swap, verbose; - med_err err; - med_idt fid,fidjoint; - med_int idom; + med_2_2::med_err err; + med_2_2::med_idt fid,fidjoint; + med_2_2::med_int idom; //master.xml - string filemaster,domainname; + std::string filemaster,domainname; char distfilename[MED_TAILLE_DESC]; xmlDocPtr master_doc; xmlNodePtr root_node,node,node2, @@ -115,16 +113,16 @@ public: char maillage_description[MED_TAILLE_DESC+1]; char nomcoo[3*MED_TAILLE_PNOM+1]; char unicoo[3*MED_TAILLE_PNOM+1]; - med_int *famnodesskin; //from skin.med... - med_int *famseg2skin; //...valid on global index/numerotation - med_int *famtria3skin; + 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; //to final files .med with tetrahedra char nomfinal[MED_TAILLE_NOM+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; + 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; //low level bool list_keys_mesh_wrap(); //list keys @@ -136,9 +134,9 @@ public: CVWtab* restore_key(const QString &key); //family level - 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); + 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); 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 6336b64..a7decf8 100755 --- a/src/tepal2med/ghs3dprl_msg_parser.cxx +++ b/src/tepal2med/ghs3dprl_msg_parser.cxx @@ -28,8 +28,6 @@ #include "ghs3dprl_msg_parser.h" #include "ghs3dprl_mesh_wrap.h" -using namespace med_2_2; - //************************************ bool ghs3dprl_msg_parser::startDocument() { @@ -200,7 +198,7 @@ bool ghs3dprl_msg_parser::endElement(const QString &namespaceURI, bool ghs3dprl_msg_parser::characters(const QString &strini) { bool ok; - med_int *tmint=NULL; + med_2_2::med_int *tmint=NULL; long nb=0; //filtre rc,lf,tab et blancs successifs QString str=strini.simplified(); @@ -227,7 +225,7 @@ bool ghs3dprl_msg_parser::characters(const QString &strini) { //lecture vecteurs d'entiers separateur blanc long i=0; - tmint=new med_int[nb]; + tmint=new med_2_2::med_int[nb]; //printf("%staille attendue=%i taille vue=%i\n",(const char *)indent.toLatin1().constData(),nbcount,nb); do { @@ -243,7 +241,7 @@ bool ghs3dprl_msg_parser::characters(const QString &strini) } if (nb==1) { - tmint=new med_int[nb]; + tmint=new med_2_2::med_int[nb]; tmint[0]=str.toLong(&ok); if (!ok) { diff --git a/src/tepal2med/tepal2med.cxx b/src/tepal2med/tepal2med.cxx index de5a911..4fd6a1e 100755 --- a/src/tepal2med/tepal2med.cxx +++ b/src/tepal2med/tepal2med.cxx @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include @@ -53,42 +53,39 @@ extern "C" { #include } -using namespace std; -using namespace med_2_2; - //************************************ -med_idt ouvre_fichier_MED(char *fichier,int verbose) +med_2_2::med_idt ouvre_fichier_MED(char *fichier,int verbose) { - med_idt fid = 0; - med_err ret = 0; - med_int majeur,mineur,release; + med_2_2::med_idt fid = 0; + med_2_2::med_err ret = 0; + med_2_2::med_int majeur,mineur,release; /* on regarde si le fichier existe */ ret = (int) access(fichier,F_OK); if (ret < 0) return fid; /* on regarde s'il s'agit d'un fichier au format HDF5 */ - ret = MEDformatConforme(fichier); + ret = med_2_2::MEDformatConforme(fichier); 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 = med_2_2::MEDouvrir(fichier,med_2_2::MED_LECTURE); if (ret < 0) return fid; - MEDversionLire(fid, &majeur, &mineur, &release); + med_2_2::MEDversionLire(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érieure à la version 2.2"; - ret = MEDfermer(fid); + ret = med_2_2::MEDfermer(fid); fid=0; } else { if (verbose>0)fprintf(stdout,", file from MED V%d.%d.%d\n",majeur,mineur,release); } @@ -99,88 +96,88 @@ med_idt ouvre_fichier_MED(char *fichier,int verbose) //************************************ 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_2_2::med_err ret; + med_2_2::med_idt fid=0; + med_2_2::med_int i,j,mdim,nmaa,edim,majeur_lu,mineur_lu,release_lu,nprofils; + med_2_2::med_maillage type_maillage; int numero=1; - med_connectivite typ_con=MED_NOD; + med_2_2::med_connectivite typ_con=med_2_2::MED_NOD; QString key,tmp; //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, + if (nmaa > 1) std::cout<<"More than one mesh in "<nommaa,&mdim,&type_maillage, mymailw->maillage_description); if (ret < 0){ - cerr<<"Problem MEDmaaInfo in "<nommaa); + edim = med_2_2::MEDdimEspaceLire(fid,mymailw->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); + med_2_2::med_int nnoe=med_2_2::MEDnEntMaa(fid,mymailw->nommaa,med_2_2::MED_COOR,med_2_2::MED_NOEUD, + (med_2_2::med_geometrie_element)0,(med_2_2::med_connectivite)0); if (nnoe<1){ - cerr<<"Problem number of Vertices < 1\n"; - ret = MEDfermer(fid); + std::cerr<<"Problem number of Vertices < 1\n"; + ret = med_2_2::MEDfermer(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_2_2::med_int nmailles[MED_NBR_GEOMETRIE_MAILLE],nbtria3; + med_2_2::med_int nfaces[MED_NBR_GEOMETRIE_FACE]; + med_2_2::med_int naretes[MED_NBR_GEOMETRIE_ARETE],nbseg2; //polygones et polyedres familles equivalences joints - med_int nmpolygones,npolyedres,nfpolygones,nfam,nequ,njnt; + med_2_2::med_int nmpolygones,npolyedres,nfpolygones,nfam,nequ,njnt; //Combien de mailles, faces ou aretes pour chaque type geometrique ? /*for (i=0;inommaa,MED_CONN,MED_MAILLE,typmai[i],typ_con); //lecture_nombre_mailles_standards(fid,nommaa,typmai[i],typ_con,i); - if (mymailw->verbose>6) cout<<"NumberOf"<verbose>6) std::cout<<"NumberOf"<nommaa,MED_CONN,MED_MAILLE,MED_TRIA3,typ_con); - nbseg2=MEDnEntMaa(fid,mymailw->nommaa,MED_CONN,MED_MAILLE,MED_SEG2,typ_con); + nbtria3=med_2_2::MEDnEntMaa(fid,mymailw->nommaa,med_2_2::MED_CONN,med_2_2::MED_MAILLE,med_2_2::MED_TRIA3,typ_con); + nbseg2=med_2_2::MEDnEntMaa(fid,mymailw->nommaa,med_2_2::MED_CONN,med_2_2::MED_MAILLE,med_2_2::MED_SEG2,typ_con); //Combien de mailles polygones quelconques ? //nmpolygones = lecture_nombre_mailles_polygones(fid,nommaa,typ_con); @@ -188,78 +185,78 @@ bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) //npolyedres = lecture_nombre_mailles_polyedres(fid,nommaa,typ_con); //combien de familles ? - nfam=MEDnFam(fid,mymailw->nommaa); + nfam=med_2_2::MEDnFam(fid,mymailw->nommaa); if (mymailw->verbose>2) { - cout<<"\nNumberOfFamilies="<nommaa,i+1); + ngro = med_2_2::MEDnGroupe(fid,mymailw->nommaa,i+1); if (ngro < 0){ - cerr<<"Problem reading number of groups of family\n"; + std::cerr<<"Problem reading number of groups of family\n"; continue; } //nombre d'attributs - natt = MEDnAttribut(fid,mymailw->nommaa,i+1); + natt = med_2_2::MEDnAttribut(fid,mymailw->nommaa,i+1); if (natt < 0){ - cerr<<"Problem reading number of attributes of family\n"; + std::cerr<<"Problem reading number of attributes of family\n"; continue; } //nom,numero,attributs,groupes //allocation memoire par exces - attide = (med_int*) malloc(sizeof(med_int)*(natt+1)); - attval = (med_int*) malloc(sizeof(med_int)*(natt+1)); + attide = (med_2_2::med_int*) malloc(sizeof(med_2_2::med_int)*(natt+1)); + attval = (med_2_2::med_int*) malloc(sizeof(med_2_2::med_int)*(natt+1)); attdes = (char *) malloc(MED_TAILLE_DESC*(natt+1)); gro = (char*) malloc(MED_TAILLE_LNOM*(ngro+1)); - ret = MEDfamInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,attide,attval, + ret = med_2_2::MEDfamInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,attide,attval, attdes,&natt,gro,&ngro); if (ret < 0){ - cerr<<"Problem reading informations of family\n"; + std::cerr<<"Problem reading informations of family\n"; continue; } if (mymailw->verbose>8) { - cout<<"Family "<deletegroups)>0) { - //cout<<"idelete++ "<0) { //only delete family whith all delete groups - //cout<<"famdelete++ "<0) { sgro="Skin_"+sgro; //pas sur que ce soit pertinent } - if (mymailw->verbose>8) cout<<"families.add("<verbose>8) std::cout<<"families.add("<families.add(sfam,sgro); } else { //sgro="Skin_"+sgro; //pas sur que ce soit pertinent - //cout<<"--deletegroups matches \""<verbose>3) cout<<"--deletegroups matches \""<< + //std::cout<<"--deletegroups matches \""<verbose>3) std::cout<<"--deletegroups matches \""<< sgro.toLatin1().constData()<< - "\" in family "<deletegroups)==0){ //sgro="Skin_"+sgro; //pas sur que ce soit pertinent - cout<<"families.add("<families.add(sfam,sgro); } else { - cout<<"--deletegroups matches \""<verbose>3){ - cout<<"\nFamiliesAndGroupsOf "<families.write(); } - med_repere rep; - med_mode_switch mode_coo=MED_FULL_INTERLACE; + med_2_2::med_repere rep; + med_2_2::med_mode_switch mode_coo=med_2_2::MED_FULL_INTERLACE; /* Allocations memoires */ /* table des coordonnees profil : (dimension * nombre de noeuds ) */ - med_float *coo=new med_float[nnoe*mdim]; + med_2_2::med_float *coo=new med_2_2::med_float[nnoe*mdim]; /* 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 + med_2_2::med_int *famnodesskin=new med_2_2::med_int[nnoe]; + med_2_2::med_int *pfltab=new med_2_2::med_int[1]; //inutilise car on lit tout //lecture des noeuds : coordonnees - ret=MEDcoordLire(fid,mymailw->nommaa,mdim,coo, + ret=med_2_2::MEDcoordLire(fid,mymailw->nommaa,mdim,coo, mode_coo,MED_ALL, pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo); if (ret < 0){ - cerr<<"Problem reading nodes\n"; - ret = MEDfermer(fid); + std::cerr<<"Problem reading nodes\n"; + ret = med_2_2::MEDfermer(fid); //return false; } - ret=MEDfamLire(fid,mymailw->nommaa,famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0); + ret=med_2_2::MEDfamLire(fid,mymailw->nommaa,famnodesskin,nnoe,med_2_2::MED_NOEUD,(med_2_2::med_geometrie_element) 0); if (ret < 0){ - cerr<<"Problem reading families of nodes\n"; - ret = MEDfermer(fid); + std::cerr<<"Problem reading families of nodes\n"; + ret = med_2_2::MEDfermer(fid); return false; } if (mymailw->verbose>9) { - cout<<"\nVertices: no x y z family\n"; + std::cout<<"\nVertices: no x y z family\n"; for (i=0;inommaa,mdim,conn2,mode_coo, - pfltab,0,MED_MAILLE,MED_SEG2,MED_NOD); + med_2_2::med_int *conn2=new med_2_2::med_int[nbseg2*2]; + ret=med_2_2::MEDconnLire(fid,mymailw->nommaa,mdim,conn2,mode_coo, + pfltab,0,med_2_2::MED_MAILLE,med_2_2::MED_SEG2,med_2_2::MED_NOD); if (ret < 0){ - cerr<<"Problem reading MED_SEG2\n"; - ret = MEDfermer(fid); + std::cerr<<"Problem reading MED_SEG2\n"; + ret = med_2_2::MEDfermer(fid); //return false; } - med_int *famseg2skin=new med_int[nbseg2]; - ret=MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2); + med_2_2::med_int *famseg2skin=new med_2_2::med_int[nbseg2]; + ret=med_2_2::MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,med_2_2::MED_MAILLE,med_2_2::MED_SEG2); if (ret < 0){ - cerr<<"Problem reading families of MED_SEG2\n"; - ret = MEDfermer(fid); + std::cerr<<"Problem reading families of MED_SEG2\n"; + ret = med_2_2::MEDfermer(fid); return false; } if (mymailw->verbose>9) { - cout<<"\nConnectivity MED_SEG2: no node1 node2 family\n"; + std::cout<<"\nConnectivity MED_SEG2: no node1 node2 family\n"; for (i=0;inommaa,mdim,conn3,mode_coo, - pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD); + med_2_2::med_int *conn3=new med_2_2::med_int[nbtria3*3]; + ret=med_2_2::MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo, + pfltab,0,med_2_2::MED_MAILLE,med_2_2::MED_TRIA3,med_2_2::MED_NOD); if (ret < 0){ - cerr<<"Problem reading MED_TRIA3\n"; - ret = MEDfermer(fid); + std::cerr<<"Problem reading MED_TRIA3\n"; + ret = med_2_2::MEDfermer(fid); //return false; } - med_int *famtria3skin=new med_int[nbtria3]; - ret=MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3); + med_2_2::med_int *famtria3skin=new med_2_2::med_int[nbtria3]; + ret=med_2_2::MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,med_2_2::MED_MAILLE,med_2_2::MED_TRIA3); if (ret < 0){ - cerr<<"Problem reading families of MED_TRIA3\n"; - ret = MEDfermer(fid); + std::cerr<<"Problem reading families of MED_TRIA3\n"; + ret = med_2_2::MEDfermer(fid); return false; } if (mymailw->verbose>9) { - cout<<"\nConnectivity MED_TRIA3: no node1 node2 node3 family\n"; + std::cout<<"\nConnectivity MED_TRIA3: no node1 node2 node3 family\n"; for (i=0;iverbose>3){ delete[] nufano;*/ if (ifamdelete>0) { - //cout<<"!!!!!!!!nodes "<verbose>3){ //if (mymailw->verbose>6) ok=mymailw->list_keys_mesh_wrap(); - ret = MEDfermer(fid); + ret = med_2_2::MEDfermer(fid); if (ret < 0){ - cerr<<"Problem closing "<2048){ //delirium in 2008 - cerr<<"--number: a positive integer <= 2048 is expected\n\n"; + std::cerr<<"--number: a positive integer <= 2048 is expected\n\n"; return 1; } if (!cmedname) cmedname=ccasename; @@ -627,11 +624,11 @@ int main(int argc, char *argv[]) tmp=climitswap; limit_swap=tmp.toLong(&ok,10); if (!ok){ - cerr<<"--limitswap: an integer is expected. try 1000\n\n"; + std::cerr<<"--limitswap: an integer is expected. try 1000\n\n"; return 1; } if (limit_swap<1 || limit_swap>32000){ - cerr<<"--limitswap: [1->32000] expected. try 1000\n\n"; + std::cerr<<"--limitswap: [1->32000] expected. try 1000\n\n"; return 1; } } @@ -644,11 +641,11 @@ int main(int argc, char *argv[]) tmp=cverbose; verbose=tmp.toLong(&ok,10); if (!ok){ - cerr<<"--verbose: an integer is expected\n\n"; + std::cerr<<"--verbose: an integer is expected\n\n"; return 1; } if (verbose<0){ - cerr<<"--verbose: a positive integer is expected\n\n"; + std::cerr<<"--verbose: a positive integer is expected\n\n"; return 1; } } @@ -692,7 +689,7 @@ int main(int argc, char *argv[]) m->show(); a.exec(); if ( m->result() == QDialog::Accepted ) { - cout<<"parameters "<KeepFiles()<<" "<NbPart()<KeepFiles()<<" "<NbPart()<NbPart(); } else { @@ -708,7 +705,7 @@ int main(int argc, char *argv[]) path="./"; casenamemed=casenamemed.section('/',-1); if (casenamemed.length()>20){ - cerr<<"--medname truncated (no more 20 characters)"<20){ - cerr<<"--casename truncated (no more 20 characters)"<0) - cout<<"tepal2med "< "+path+"tepal.log"; - cout<<"\nlaunchtepal command: background="<families.no=1; - //cout<<"coucou1 "<families.no<families.no<families.add(casename,casenamemed); format=format.sprintf("%d",nbfiles); int nbf=format.length(); @@ -814,7 +811,7 @@ int main(int argc, char *argv[]) //if test read all files before (only small files) if (test=="yes"){ - if (verbose>0) cout<<"\nReading output files of tepal as input files of tepal2med...\n"; + if (verbose>0) std::cout<<"\nReading output files of tepal as input files of tepal2med...\n"; //read files .msg //supposed big files big arrays so don't read with parser @@ -822,13 +819,13 @@ int main(int argc, char *argv[]) for (int i=1; i<=nbfiles; i++){ mymailw->nofile=i; tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".msg"; - if (verbose>0) cout<<"FileName="<0) std::cout<<"FileName="<ReadFileMSGnew(tmp); } if (verbose>0) - cout<<"NumberOfFilesMSGacquired="<nbfiles<<"\n\n"; + std::cout<<"NumberOfFilesMSGacquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles){ - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } @@ -841,26 +838,26 @@ int main(int argc, char *argv[]) mymailw->nofile=i; //tmp=casename+tmp.sprintf(".%d.%d.msg",nbfiles,i); tmp=pathini+casename+tmp.sprintf(format,nbfiles,i)+".msg"; - if (verbose>0) cout<<"FileName="<0) std::cout<<"FileName="<0) - cout<<"NumberOfFilesMSGAcquired="<nbfiles<<"\n"; + std::cout<<"NumberOfFilesMSGAcquired="<nbfiles<<"\n"; if (mymailw->nbfiles != nbfiles){ - cerr<<"Problem NumberOfFiles != NumberOfFilesAcquired\n"; + std::cerr<<"Problem NumberOfFiles != NumberOfFilesAcquired\n"; return 1; } if (test=="yes"){ ok=mymailw->test_msg_wrap(); if (ok){ - if (verbose>0) cout<<"\nResult_test_msg_wrap=ok\n\n"; + if (verbose>0) std::cout<<"\nResult_test_msg_wrap=ok\n\n"; } else{ - cerr<<"\nResult_test_msg_wrap=NO_OK!\n\n"; + std::cerr<<"\nResult_test_msg_wrap=NO_OK!\n\n"; return 1; } } @@ -877,7 +874,7 @@ int main(int argc, char *argv[]) //because equals nb=0; nb=mymailw->remove_key_mesh_wrap(QRegExp("RE",Qt::CaseSensitive,QRegExp::RegExp)); - if (verbose>3) cout<<"NumberOfKeysRemoved="<3) std::cout<<"NumberOfKeysRemoved="<3) ok=mymailw->list_keys_mesh_wrap(); //test read files .noboiteb @@ -890,23 +887,23 @@ int main(int argc, char *argv[]) for (int i=1; i<=nbfiles; i++){ mymailw->nofile=i; tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".noboite"; - if (verbose>0) cout<<"FileName="<0) std::cout<<"FileName="<ReadFileNOBOITE(tmp); } if (verbose>0) - cout<<"NumberOfFilesNOBOITEAcquired="<nbfiles<<"\n"; + std::cout<<"NumberOfFilesNOBOITEAcquired="<nbfiles<<"\n"; if (mymailw->nbfiles != nbfiles){ - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; return 1; } //if (test=="yes"){ ok=mymailw->test_vertices_wrap(); if (ok){ - if (verbose>0) cout<<"\nResult_test_vertices_wrap=ok\n\n"; + if (verbose>0) std::cout<<"\nResult_test_vertices_wrap=ok\n\n"; } else{ - cerr<<"\nResult_test_vertices_wrap=NO_OK!\n\n"; + std::cerr<<"\nResult_test_vertices_wrap=NO_OK!\n\n"; return 1; } //} @@ -916,13 +913,13 @@ int main(int argc, char *argv[]) for (int i=1; i<=nbfiles; i++){ mymailw->nofile=i; tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".faces"; - if (verbose>0) cout<<"FileName="<0) std::cout<<"FileName="<ReadFileFACES(tmp); } if (verbose>0) - cout<<"NumberOfFilesFACESAcquired="<nbfiles<<"\n\n"; + std::cout<<"NumberOfFilesFACESAcquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles){ - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } @@ -932,14 +929,14 @@ int main(int argc, char *argv[]) for (int i=1; i<=nbfiles; i++){ mymailw->nofile=i; tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".points"; - if (verbose>0) cout<<"FileName="<0) std::cout<<"FileName="<ReadFilePOINTS(tmp); } if (verbose>0) - cout<<"NumberOfFilesPOINTSAcquired="<nbfiles<<"\n\n"; + std::cout<<"NumberOfFilesPOINTSAcquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles) { - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } */ @@ -950,14 +947,14 @@ int main(int argc, char *argv[]) for (int i=1; i<=nbfiles; i++){ mymailw->nofile=i; tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".glo"; - if (verbose>0) cout<<"FileName="<0) std::cout<<"FileName="<ReadFileGLO(tmp); //mymailw->SwapOutOfMemory_key_mesh_wrap(QRegExp("GL",true,false)); } if (verbose>0) - cout<<"NumberOfFilesGLOAcquired="<nbfiles<<"\n\n"; + std::cout<<"NumberOfFilesGLOAcquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles){ - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } @@ -977,7 +974,7 @@ int main(int argc, char *argv[]) //test remove points (type 3) //nb=mymailw->remove_key_mesh_wrap(QRegExp("PO",true,false)); - //cout<<"***remove_key_mesh_wrap*** remove nb="<0)cout<3)std::cout<<"***remove_all_key_mesh_wrap*** "<0)std::cout<