From 8650d6aaf784a2d61c0b6f7bb071b3c9d81fe61d Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 15 Jan 2010 08:35:13 +0000 Subject: [PATCH] 0020636: [CEA 379] validation Tepal V2 GHS3DPRL and MEDsplitter and doc --- src/tepal2med/ghs3dprl_mesh_wrap.cxx | 872 ++++++++++++++------------- src/tepal2med/tepal2med.cxx | 405 ++++++------- 2 files changed, 658 insertions(+), 619 deletions(-) diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index d6c4186..a8d858b 100755 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -25,6 +25,7 @@ #include "ghs3dprl_mesh_wrap.h" +#include #include #include #include @@ -37,19 +38,22 @@ #include #include +using namespace std; +using namespace med_2_2; + //utils procedures //************************************ -std::string i2a(const int &v) +string i2a(const int &v) { - std::ostringstream ss; + ostringstream ss; ss<\tGroups="; + cout<<"Family=<"<<(*it1).first.toLatin1().constData()<<">\tGroups="; gb=(*it1).second; for (it2=gb.begin(); it2!=gb.end(); ++it2){ - std::cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; + cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; } - std::cout<\tFamilies="; + cout<<"Group=<"<<(*it1).first.toLatin1().constData()<<">\tFamilies="; gb=(*it1).second; for (it2=gb.begin(); it2!=gb.end(); ++it2){ - std::cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; + cout<<"<"<<(*it2).first.toLatin1().constData()<<"> "; } - std::cout<\t<"<\n"; + //cout<<"add family <"<\t<"<\n"; fagr::iterator it; it=fam.find(nomfam); if (it==fam.end()){ - //std::cout<<"add new family <"<\t<"<\n"; + //cout<<"add new family <"<\t<"<\n"; newfam(nomfam); it=fam.find(nomfam); } @@ -161,7 +165,7 @@ void charendnull(char *p, QString deb, int lg) (*it).second[nomgro]=0; it=gro.find(nomgro); if (it==gro.end()){ - //std::cout<<"***new*** "<= 0 family zero and family nodes //outputs in *ires and *tmp @@ -187,19 +191,19 @@ bool familles::get_number_of_new_family(int sign, med_2_2::med_int *ires, QStrin it=fam.find(nomfam); if (it==fam.end()) { *tmp=nomfam; *ires=ii; - //std::cout<<"NewFamily Found<"<<*ires<<"><"<<*tmp<<">\n"; + //cout<<"NewFamily Found<"<<*ires<<"><"<<*tmp<<">\n"; return true; } ii=ii+pas; } - std::cerr<<"***get_number_of_new_family*** Problem new family not found"< from <"<< + //cout<<"find_family_on_groups old <"< from <"<< // fam1<<"><"<\n"; return ires; } } - //std::cout<<"no family found!!! - groups of "<add(tmp,(*it).first); } - //std::cout<<"new family <"< intersection of <"<<"<\n"; + //cout<<"new family <"< intersection of <"<<"<\n"; return ires; } //************************************ - fend familles::fuse_goups(med_2_2::med_int fam1, med_2_2::med_int fam2) + fend familles::fuse_goups(med_int fam1, med_int fam2) //concatenation/fusion deux map groupes { QString nom1,nom2; @@ -237,7 +241,7 @@ bool familles::get_number_of_new_family(int sign, med_2_2::med_int *ires, QStrin nom2=nom2.sprintf("%d",fam2); it2=fam.find(nom2); if ( (it1==fam.end())||(it2==fam.end()) ) { - std::cerr<<"***fuse_goups*** non existing family "< "; + cout<<"<"<<(*it).first.toLatin1().constData()<<"> "; } - std::cout<memorymax) { - std::cout<<"***WARNING*** memory max reached "<memorymax) { - std::cout<<"***WARNING*** memory max reached "<filename<filename<CVWtab_deallocate(); //remove temporary file if (this->filename!="_NO_FILE") { remove(this->filename.toLatin1().constData()); //#include - //std::cout<filename<<" successfully deleted\n"; + //cout<filename<<" successfully deleted\n"; } } @@ -309,37 +313,37 @@ CVWtab::~CVWtab() //************************************ bool CVWtab::CVWtab_deallocate() { - //std::cout<<" deallocate CVWtab*** "<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<type==1) cout<<"med_int tab1[0]="<tmint[0]<type==2) cout<<"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) - { std::cout<<"***is_equal*** pb pointer NULL with tmint size="<size<size<size<=tab1->size) { - std::cerr<<"BadIndice tab1 in is_equal_vertices "<< - di1<<" not in "<size<size<=tab2->size) { - std::cerr<<"BadIndice tab2 in is_equal_vertices "<< - di2<<" not in "<size<size<tmflo+di1); @@ -395,11 +399,11 @@ bool CVW_is_equal_vertices(CVWtab *tab1, long i1, } //************************************ -bool CVW_FindString(const std::string &str,std::fstream &Ff, long &count) +bool CVW_FindString(const string &str,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 { - std::string line; + string line; QString tmp; do { @@ -418,7 +422,7 @@ bool CVW_FindString(const std::string &str,std::fstream &Ff, long &count) } else { - std::cerr<<"Problem line '"< for speed (and so no test) { QString tmp; - std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); - std::string line; + fstream Ff(FileName.toLatin1().constData(),ios_base::in); + string line; long i,count,nbneighbour,ineighbour; bool ok; if (!Ff.is_open()) { - std::cerr<<"Problem File '"<nofile<<"="<4) cout<<"Vertices "<nofile,ineighbour); @@ -460,9 +464,9 @@ bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName) } if (!CVW_FindString("4) cout<<"Edges "<nofile,ineighbour); @@ -470,9 +474,9 @@ bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName) } if (!CVW_FindString("4) cout<<"Faces "<nofile,ineighbour); @@ -480,9 +484,9 @@ bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName) } if (!CVW_FindString("4) cout<<"Elements "<nofile,ineighbour); @@ -501,25 +505,25 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) //read file .glo with no parser xml because big file (volume) { QString tmp; - std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); - std::string line; + fstream Ff(FileName.toLatin1().constData(),ios_base::in); + string line; long count; bool ok; if (!Ff.is_open()) { - std::cerr<<"Problem File '"<4) cout<<"Elements "<nofile); @@ -527,12 +531,12 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) } if (!CVW_FindString("4) cout<<"Elements "<nofile); @@ -540,12 +544,12 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) } if (!CVW_FindString("4) cout<<"Elements "<nofile); @@ -553,12 +557,12 @@ bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName) } if (!CVW_FindString("4) cout<<"Elements "<nofile); @@ -575,19 +579,19 @@ bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName) //read file .faces (wrap) { QString tmp; - std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); - std::string line; + fstream Ff(FileName.toLatin1().constData(),ios_base::in); + string line; long nbelem,ntype; bool ok; if (!Ff.is_open()) { - std::cerr<<"Problem File '"<3) std::cout<<"FacesNumberOfElements="<3) cout<<"FacesNumberOfElements="<>ntype; if (ntype!=3) //only triangles { - std::cerr<<"Problem on ntype != 3"<>tmint[i+j]; - //for (int j=0; j<7; j++) std::cout<4) std::cout<<"Elements "<4) cout<<"Elements "<nofile); @@ -629,46 +633,46 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITE(const QString FileName) //(parameter option of ghs3d but NOT tepal) { QString tmp; - std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + fstream Ff(FileName.toLatin1().constData(),ios_base::in); long ne,np,npfixe,subnumber,reste; bool ok; if (!Ff.is_open()){ - std::cerr<<"Problem File '"<>ne>>np>>npfixe; if (verbose>3){ - std::cout<<"NoboiteNumberOfElements="<>tmint[i]; - if (verbose>4) std::cout<<"Elements "<4) cout<<"Elements "<nofile); ok=this->insert_key(tmp,montab); - med_2_2::med_float *tmflo=new med_2_2::med_float[np*3]; + med_float *tmflo=new med_float[np*3]; for (int i=0; i>tmflo[i]; - if (verbose>4) std::cout<<"Vertices "<4) cout<<"Vertices "<nofile); ok=this->insert_key(tmp,montab); Ff>>subnumber; - if (verbose>2) std::cout<<"NumberOfSubdomains="<2) cout<<"NumberOfSubdomains="<>tmint[i]; - if (verbose>4) std::cout<<"Subdomains "<4) cout<<"Subdomains "<nofile); @@ -694,7 +698,7 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITEB(const QString FileName) { bool ok; QString tmp; - std::cerr<<"Problem function ReadFileNOBOITEB\n" + cerr<<"Problem function ReadFileNOBOITEB\n" <<"(no FORTRAN binary format files in tepal)\n\n"; //file binary FILE *Ff=fopen(FileName.toLatin1().constData(),"rb"); @@ -705,43 +709,43 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITEB(const QString FileName) //=> 2*long(68) (68=17*4octets) long r1[17+2]; if (!Ff){ - std::cerr<<"Problem File '"<3){ - std::cout<<"NoboitebNumberOfElements="<4) cout<<"Elements "<nofile); ok=this->insert_key(tmp,montab); fread(&reste,sizeof(long),1,Ff); - //std::cout<<"info "<2) std::cout<<"NumberOfSubdomains="<2) cout<<"NumberOfSubdomains="<4) printf("Subdomains %ld %ld ... %ld \n",tlong[0],tlong[1],tlong[subnumber*3-1]); - tmint=new med_2_2::med_int[subnumber*3]; + tmint=new med_int[subnumber*3]; for (long i=0; i2) std::cout<<"NumberOfVertices="<2) cout<<"NumberOfVertices="< size="<size< size="<size<verbose>6) std::cout<<"remove key "<verbose>6) cout<<"remove key "< it(this->mestab); while ( it.hasNext() ){ it.next(); if (it.key().contains(rxp)) nbremove++; } - //std::cout<<"nb_key_mesh_wrap found "<tmint){ if (verbose>3) - std::cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< + cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< " NbElements "<tmint,sizeof(med_2_2::med_int),taille,fichier); + " SizeElement_med_int "<tmint,sizeof(med_int),taille,fichier); //fread(&gagnants,sizeof(gagnants),1,fichier); } if (tab->tmflo){ if (verbose>3) - std::cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< + cout<<"SwapOnFile_binary "<filename.toLatin1().constData()<< " NbElements "<tmflo,sizeof(med_2_2::med_float),taille,fichier); + " SizeElement_med_float "<tmflo,sizeof(med_float),taille,fichier); } fclose(fichier); } else{ - if (verbose>3) std::cout<<"SwapOnFile in binary file done yet "<< - tab->filename.toLatin1().constData()<3) cout<<"SwapOnFile in binary file done yet "<< + tab->filename.toLatin1().constData()<CVWtab_deallocate(); //free memory @@ -952,9 +956,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) - std::cout<<"SwapOutOfMemory_key_mesh_wrap on demand "<< + cout<<"SwapOutOfMemory_key_mesh_wrap on demand "<< it.key().toLatin1().constData()<< - " size "<size<<">"<size<<">"<path,it.value(),this->verbose); } @@ -967,34 +971,34 @@ bool ghs3dprl_mesh_wrap::list_onekey_mesh_wrap(const QString &key) { CVWtab *montab=this->mestab[key]; if (montab){ - //std::cout<<"key "< size="<size< size="<size<type==1) for ( long i=0; isize; i++ ) - std::cout<tmint[i]<<" "; + cout<tmint[i]<<" "; if (montab->type==2) for ( long i=0; isize; i++ ) - std::cout<tmflo[i]<<" "; - std::cout<tmflo[i]<<" "; + cout<nbelem_limit_swap +//insertion conditionn� par limite this->nbelem_limit_swap //si tableaux contenus on dimension superieure //alors swap disque dans getenv(tmp) fichier temporaire binaire { bool ok; if (verbose>4) - std::cout<<"insert key "<nbelem_limit_swapsize) { - if (verbose>3) std::cout<<"insert key automatic SwapOnFile "<< - key.toLatin1().constData()<3) cout<<"insert key automatic SwapOnFile "<< + key.toLatin1().constData()<path,tab,this->verbose); } this->mestab.insert(key,tab); @@ -1002,65 +1006,65 @@ bool ghs3dprl_mesh_wrap::insert_key(const QString &key,CVWtab *tab) } //************************************ CVWtab* ghs3dprl_mesh_wrap::restore_key(const QString &key) -//retauration conditionnée par limite nbelem +//retauration conditionn� par limite nbelem //si tableaux contenus on dimension superieure a nbelem //alors swap disque dans getenv(tmp) fichier temporaire //alors lecture du fichier (et reallocate memory) { CVWtab *tab=NULL; tab=this->mestab[key]; - /*if (tab) std::cout<<" -> size in proc "<size< tab NULL\n";*/ + /*if (tab) cout<<" -> size in proc "<size< tab NULL\n";*/ if (!tab) //it is NOT a problem { - if (verbose>6) std::cout<<"restore key not found "<6) cout<<"restore key not found "<size > 0){ - if (verbose>5) std::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){ - std::cerr<<"Problem restore_key from binary file "<filename.toLatin1().constData()<< - " size unexpexted "<size<filename.toLatin1().constData()<< + " size unexpexted "<size<type==1){ if (verbose>5) - std::cout<<"restore key from binary file "<filename.toLatin1().constData()<< + cout<<"restore key from binary file "<filename.toLatin1().constData()<< " number of elements "<tmint=new med_2_2::med_int[taille]; //allocate memory - fread(tab->tmint,sizeof(med_2_2::med_int),taille,fichier); + tab->tmint=new med_int[taille]; //allocate memory + fread(tab->tmint,sizeof(med_int),taille,fichier); } if (tab->type==2){ if (verbose>5) - std::cout<<"restore key from binary file "<filename.toLatin1().constData()<< + cout<<"restore key from binary file "<filename.toLatin1().constData()<< " number of elements "<tmflo=new med_2_2::med_float[taille]; //allocate memory + tab->tmflo=new med_float[taille]; //allocate memory for (int i=0; itmflo[i]=-1e0; - fread(tab->tmflo,sizeof(med_2_2::med_float),taille,fichier); - /*for (int i=0; itmflo[i]<<"/"; - std::cout<tmflo,sizeof(med_float),taille,fichier); + /*for (int i=0; itmflo[i]<<"/"; + cout<size=-tab->size; @@ -1084,26 +1088,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"; - //std::cout<<"key "<restore_key(key1); //tab1=this->mestab[key1]; tab2=this->restore_key(key2); //tab2=this->mestab[key2]; - //std::cout<<"sortie key "<is_equal(tab2)) - { std::cout<<"key "<restore_key(key2); //tab2=this->mestab[key2]; if (!tab1 && !tab2) continue; //case not neighbours if (!tab1) - { std::cout<<"key "<type!=tab2->type)||(tab1->size!=tab2->size)) - { std::cout<<"key "<size!=tab2->size) { - std::cerr<<"TestEqualityCoordinates key "<2)&&(ok1)) - std::cout<<"TestEqualityCoordinates "<size<< - " Vertices "<size<< + " Vertices "<size<< - " Vertices "<size<< + " Vertices "<restore_key(QString("SKIN_VERTICES_COORDINATES")); - if (verbose>4)std::cout<<"NumberVerticesSKIN="<size/3<4)cout<<"NumberVerticesSKIN="<size/3<nbfiles; ifile++) { @@ -1260,22 +1264,22 @@ bool ghs3dprl_mesh_wrap::Find_VerticesDomainToVerticesSkin() key2=key2.sprintf("GL%ld VE",ifile); glodom=this->restore_key(key2); if (verbose>4) - std::cout<<"NumberVerticesDOMAIN_"<size<size]; + med_int *tab=new med_int[glodom->size]; i=0; nb=0; //nb equals vertices if (verbose>8){ - std::cout<<"\nglobal numbering nodes: no iglo\n"; + cout<<"\nglobal numbering nodes: no iglo\n"; for (jd=0; jd < glodom->size; jd++) - std::cout<<"\t"<tmint[jd]<tmint[jd]<size; jd=jd+3) { p2=(coodom->tmflo+jd); @@ -1286,8 +1290,8 @@ bool ghs3dprl_mesh_wrap::Find_VerticesDomainToVerticesSkin() p1=(cooskin->tmflo+js); if (p1[0]==p2[0] && p1[1]==p2[1] && p1[2]==p2[2]) { - std::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){ - std::cout<<"NumberOfEqualsVerticesDOMAIN_"<med_nomfinal no more 32 character //if path, in this->path. //20 preserve for add postfixes "_idom" etc... - if (verbose>0)std::cout<<"\nWrite_MEDfiles_v2\n"; - if (verbose>6){std::cout<<"\nInitialFamilies\n"; families.write();} + if (verbose>0)cout<<"\nWrite_MEDfiles_v2\n"; + if (verbose>6){cout<<"\nInitialFamilies\n"; families.write();} medname=medname.section('/',-1); if (medname.length()>20) { - std::cerr<<"CaseNameMed truncated (no more 20 characters)"<0) std::cout<<"CreateMEDFile for all joints <"<\n"; + 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 tmp=path+medname+"_skin.med"; - cmd="cp "+pathini+casename+"_skin.med "+tmp; - //std::cout<<"Copy skin.med Command = "<0)std::cout<<"CreateMEDFile for initial skin <"<\n"; + cmd=pathini+casename+"_skin.med"; + int ret = access(cmd.toLatin1().constData(),F_OK); //on regarde si le fichier existe + if (ret >= 0) { + cmd="cp "+pathini+casename+"_skin.med "+tmp; + //cout<<"Copy skin.med Command = "<0) cout<<"CreateMEDFile for initial skin <"<\n"; } + else { + if (verbose>0) cout<<"No CreateMEDFile <"< for initial skin because <"<< + cmd.toLatin1().constData()<<"> does not exist\n"; } //define family 0 if not existing, no groups families.add("0",""); @@ -1465,45 +1475,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) std::cout<<"--deletegroups matches \"All_Nodes\"\n"; + else if (verbose>3) 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) std::cout<<"--deletegroups matches \"All_Faces\"\n"; + else if (verbose>3) 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) std::cout<<"--deletegroups matches \"All_Tetrahedra\"\n"; + else if (verbose>3) 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) std::cout<<"--deletegroups matches \"New_Nodes\"\n"; + else if (verbose>3) 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) std::cout<<"--deletegroups matches \"New_Faces\"\n"; + else if (verbose>3) 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) std::cout<<"--deletegroups matches \"New_Tetrahedra\"\n"; + else if (verbose>3) cout<<"--deletegroups matches \"New_Tetrahedra\"\n"; - if (verbose>6){std::cout<<"\nIntermediatesFamilies\n"; families.write();} - if (verbose>6) std::cout<<"\nNumber0fFiles="<6){cout<<"\nIntermediatesFamilies\n"; families.write();} + if (verbose>6) cout<<"\nNumber0fFiles="<"<"<0){ - if (verbose>2) std::cout<\n"; + if (verbose>2) cout<\n"; } //create mesh @@ -1533,58 +1543,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) std::cout<<"Description : "<4) cout<<"Description : "<6){std::cout<<"\nFinalsFamilies\n"; families.write();} + if (verbose>6){cout<<"\nFinalsFamilies\n"; families.write();} //for nodes families nb=create_families(fid,1); - if (verbose>5)std::cout<<"NumberOfFamiliesNodes="<5)cout<<"NumberOfFamiliesNodes="<8) - std::cout<<"MEDfamEcr nodes "<5)std::cout<<"NumberOfFamiliesFacesAndEdgesEtc="<5)cout<<"NumberOfFamiliesFacesAndEdgesEtc="<8) - std::cout<<"MEDfamEcr tria3 "<8) - std::cout<<"MEDfamEcr tetra4 "<0)std::cout<<"\nTotalNumberOftetrahedra="<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=med_2_2::MEDcoordEcr(fid,nomfinal,3,tab->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="<tmflo,MED_FULL_INTERLACE, + nbnodes,MED_CART,nomcoo,unicoo); + if (err<0) {cerr<<"Problem MEDcoordEcr"<4)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) {std::cerr<<"Problem file "<restore_key(key1); //tab1=this->mestab[key1]; if (!tab1) return false; } - if (nbnodes!=tab1->size){std::cerr<<"Problem size GLi VE!=nbnodes!"<size){cerr<<"Problem size GLi VE!=nbnodes!"<restore_key(key2); //tab1=this->mestab[key1]; - med_2_2::med_int nbskin=tab2->size; - //for (i=0; itmint[i]<size; + //for (i=0; itmint[i]<tmint[j]<< + //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_2_2::MED_NOEUD,med_2_2::MED_NONE); - if (err<0){std::cerr<<"Problem MEDglobalNumEcr nodes"<tmint,nbnodes,MED_NOEUD,MED_NONE); + if (err<0){cerr<<"Problem MEDglobalNumEcr nodes"< newfam "< newfam "<300) std::cout<< - "***set_one_more_family*** warning many initial families could decrease speed "<300) cout<< + "***set_one_more_family*** warning many initial families could decrease speed "< newfam "< newfam "<=0) newfami[ii]=newfam; } /*else { - std::cout<<"!!! oldfam "< newfam "< newfam "<size/7; - if (verbose>4) std::cout<<"NumberOfTriangles="<4) cout<<"NumberOfTriangles="<tmint[i]; ii++; @@ -1795,34 +1806,35 @@ bool ghs3dprl_mesh_wrap::idom_faces() arrayi[ii]=tab1->tmint[i+2]; ii++; i=i+7; } - 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); + err=MEDconnEcr(fid,nomfinal,3,arrayi,MED_FULL_INTERLACE,nbtria3,MED_MAILLE,MED_TRIA3,MED_NOD); delete[] arrayi; //need immediately more little array - if (err<0){std::cerr<<"Problem MEDconnEcr for triangles connectivity"< arrayi[i]=!NBFACES!+i+1 - arrayi=new med_2_2::med_int[nbtria3]; + arrayi=new med_int[nbtria3]; for (i=0; irestore_key(key1); //tab1=this->mestab[key1]; - if (nbtria3!=tab1->size){std::cerr<<"Problem size GLi FA!=nbtria3!"<size){cerr<<"Problem size GLi FA!=nbtria3!"<restore_key(key2); //tab1=this->mestab[key1]; - med_2_2::med_int nbskin=tab2->size; - + med_int nbskin=0; + if (tab2) med_int nbskin=tab2->size; + //set families of faces existing in GHS3DPRL_skin.med - med_2_2::med_int nb=nbtria3; - famtria3=new med_2_2::med_int[nb]; + med_int nb=nbtria3; + famtria3=new med_int[nb]; for (i=0; i2) - // std::cout<<"CreateMEDglobalNumerotation_Faces "<size<tmint,tab1->size,med_2_2::MED_MAILLE,med_2_2::MED_TRIA3); - if (err<0){std::cerr<<"Problem MEDglobalNumEcr faces"<2) + cout<<"CreateMEDglobalNumerotation_Faces "<size<tmint,tab1->size,MED_MAILLE,MED_TRIA3); + if (err<0){cerr<<"Problem MEDglobalNumEcr faces"<remove_key_mesh_wrap(QRegExp("FC*",true,true)); tmp=tmp.sprintf("GL%d FA",idom); @@ -1858,15 +1870,15 @@ bool ghs3dprl_mesh_wrap::idom_joints() bool ok=true; QString tmp,namejoint,key,key1,key2; CVWtab *tab,*tab1,*tab2; - med_2_2::med_int ineig,ii,jj,i,j,k,*arrayi,nb,famjoint,*fammore,*inodes,*arrayfaces; - med_2_2::med_float *arraynodes; + 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]; - med_2_2::med_int numfam_ini_wrap=100; + med_int numfam_ini_wrap=100; joints_node=xmlNewNode(NULL, BAD_CAST "joints"); //masterfile.xml - med_2_2::med_int nbjoints=0,nbnodesneig,nbtria3neig; - std::string sjoints=""; //which domains are neighbourg + med_int nbjoints=0,nbnodesneig,nbtria3neig; + string sjoints=""; //which domains are neighbourg int xx; tmp=tmp.sprintf("MS%d *",idom); @@ -1887,7 +1899,7 @@ bool ghs3dprl_mesh_wrap::idom_joints() tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".msg"; ok=this->ReadFileMSGnew(tmp); if (!ok) { - std::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) std::cerr<<"Problem nodes joint with no in file .msg"<size; nbnodesneig=nb; + key1=key1.sprintf("MS%d NE%d VE SE",ineig,idom); //SE or RE identicals + tab2=this->restore_key(key1); + //if not yet loaded (first time) try to load necessary file msg of neighbourg + if (!tab2) { + tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,ineig)+".msg"; + this->nofile=ineig; //neighbourg file + ok=this->ReadFileMSGnew(tmp); + this->nofile=idom; //restaure initial domain + if (!ok) { + cerr<<"Problem in file "<restore_key(key1); + } + if (!tab2) cerr<<"Problem existing nodes joint in domain "<size; nbnodesneig=tab2->size; + if (nb!=nbnodesneig) { + cerr<<"Problem in file "<"<4) - std::cout<<"NumberOfNodesOfJoint_"<restore_key(key); //tab1=this->mestab[key1]; @@ -1928,10 +1961,10 @@ bool ghs3dprl_mesh_wrap::idom_joints() //writing correspondence nodes-nodes //two indices for one correspondence - arrayi=new med_2_2::med_int[nb*2]; - arraynodes=new med_2_2::med_float[nbnodesneig*3]; //for file DOMAIN_join.med - inodes=new med_2_2::med_int[nbnodes]; //for file DOMAIN_join.med - med_2_2::med_int * fammore=new med_2_2::med_int[nbnodes]; + arrayi=new med_int[nb*2]; + arraynodes=new med_float[nbnodesneig*3]; //for file DOMAIN_join.med + inodes=new med_int[nbnodes]; //for file DOMAIN_join.med + med_int * fammore=new med_int[nbnodes]; for (i=0; itmint[i]; ii++; arrayi[ii]=tab2->tmint[i]; ii++; } - ok=set_one_more_family(famnodes,fammore,nbnodes); + if (namejoint.contains(deletegroups)==0){ + ok=set_one_more_family(famnodes,fammore,nbnodes); + } delete[] fammore; - err=med_2_2::MEDjointEcr(fid,nomfinal,namejnt,arrayi,nb, - med_2_2::MED_NOEUD,med_2_2::MED_NONE,med_2_2::MED_NOEUD,med_2_2::MED_NONE); - if (err<0) std::cerr<<"Problem MEDjointEcr nodes"<restore_key(key1); //tab1=this->mestab[key1]; if (!tab1){ if (verbose>4) - std::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) std::cerr<<"Problem triangles joint send with no receive"<restore_key(key1); + if (!tab2) cerr<<"Problem existing triangles of joint in domain "<size; nbtria3neig=tab2->size; + if (nb!=nbtria3neig) { + cerr<<"Problem in file "<"<restore_key(key); //tab1=this->mestab[key1]; - med_2_2::med_int nb=tab1->size; nbtria3neig=nb; + med_int nb=tab1->size; nbtria3neig=nb; if (verbose>4) - std::cout<<"NumberOfTrianglesOfJoint_"<0) { - //for (i=0; iremove_key_mesh_wrap(QRegExp(tmp,true,true)); xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp)); - tmp=tmp.sprintf("MS%d NE*",idom); + //tmp=tmp.sprintf("MS%d NE*",idom); //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true)); - xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp)); + //xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp)); tmp=tmp.sprintf("FC%d",idom); //qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true)); xx=this->remove_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp)); @@ -2081,7 +2127,7 @@ bool ghs3dprl_mesh_wrap::idom_tetras() bool ok=true; QString tmp,key1; CVWtab *tab1; - med_2_2::med_int i,*arrayi; + med_int i,*arrayi; int xx; //writing connectivity of tetrahedra by nodes @@ -2089,19 +2135,19 @@ bool ghs3dprl_mesh_wrap::idom_tetras() tab1=this->restore_key(key1); //tab1=this->mestab[key1]; nbtetra4=tab1->size/4; nbtetrastotal=nbtetrastotal + nbtetra4; - if (verbose>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"<5)cout<<"NumberOftetrahedra="<tmint,MED_FULL_INTERLACE,nbtetra4,MED_MAILLE,MED_TETRA4,MED_NOD); + if (err<0){cerr<<"Problem MEDconnEcr for tetra connectivity"<size!=nbtetra4){ - std::cerr<<"Problem incorrect size of tetrahedra global numbering"<2) - std::cout<<"CreateMEDglobalNumerotation_tetrahedra "<size<tmint,tab1->size,med_2_2::MED_MAILLE,med_2_2::MED_TETRA4); - if (err<0){std::cerr<<"Problem MEDglobalNumEcr tetrahedra"<size<tmint,tab1->size,MED_MAILLE,MED_TETRA4); + if (err<0){cerr<<"Problem MEDglobalNumEcr tetrahedra"<remove_key_mesh_wrap(QRegExp(tmp,true,true)); @@ -2129,15 +2175,15 @@ bool ghs3dprl_mesh_wrap::idom_tetras() } //************************************ -med_2_2::med_int ghs3dprl_mesh_wrap::create_families(med_2_2::med_idt fid, int sign) +med_int ghs3dprl_mesh_wrap::create_families(med_idt fid, int sign) //if sign < 0 families faces or tria3 etc... //if sign >= 0 family zero and family nodes { - med_2_2::med_int pas,ires; + med_int pas,ires; char nomfam[MED_TAILLE_NOM+1]; //it.current()->name; char attdes[MED_TAILLE_DESC+1]="_NO_DESCRIPTION"; char *gro; - med_2_2::med_int i,attide=1,attval=1,natt=1,num,ngro; + med_int i,attide=1,attval=1,natt=1,num,ngro; if (sign>=0) pas=1; else pas=-1; ires=0; @@ -2150,24 +2196,24 @@ med_2_2::med_int ghs3dprl_mesh_wrap::create_families(med_2_2::med_idt fid, int s if ((pas== 1) && (num< 0)) continue; //not good families charendnull(nomfam,(*it1).first,MED_TAILLE_NOM); ires++; - //med_2_2::med_int natt=0; + //med_int natt=0; ngro=(*it1).second.size(); if (verbose>5) - std::cout<<"CreateFamilyInMEDFile <"<\tNbGroups="<\tNbGroups="<5)std::cout<<" <"<<&gro[i*MED_TAILLE_LNOM]<<"> "; + if (verbose>5)cout<<" <"<<&gro[i*MED_TAILLE_LNOM]<<"> "; i++; } - if (verbose>5)std::cout<5)cout< #include -#include +#include #include #include #include @@ -53,39 +51,42 @@ extern "C" { #include } +using namespace std; +using namespace med_2_2; + //************************************ -med_2_2::med_idt ouvre_fichier_MED(char *fichier,int verbose) +med_idt ouvre_fichier_MED(char *fichier,int verbose) { - med_2_2::med_idt fid = 0; - med_2_2::med_err ret = 0; - med_2_2::med_int majeur,mineur,release; + med_idt fid = 0; + med_err ret = 0; + 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 = med_2_2::MEDformatConforme(fichier); + ret = MEDformatConforme(fichier); if (ret < 0){ - std::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 = med_2_2::MEDouvrir(fichier,med_2_2::MED_LECTURE); + fid = MEDouvrir(fichier,MED_LECTURE); if (ret < 0) return fid; - med_2_2::MEDversionLire(fid, &majeur, &mineur, &release); + 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 = med_2_2::MEDfermer(fid); + //" version est ant�ieure �la version 2.2"; + ret = MEDfermer(fid); fid=0; } else { if (verbose>0)fprintf(stdout,", file from MED V%d.%d.%d\n",majeur,mineur,release); } @@ -96,88 +97,88 @@ med_2_2::med_idt ouvre_fichier_MED(char *fichier,int verbose) //************************************ bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) { - 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; + 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; int numero=1; - med_2_2::med_connectivite typ_con=med_2_2::MED_NOD; + med_connectivite typ_con=MED_NOD; QString key,tmp; //version qt3 char chaine[nomfilemed.length()+1]; strncpy(chaine,nomfilemed.toLatin1().constData(),nomfilemed.length()+1); - //std::cout<<"*** ReadFileMED *** "<verbose); if (fid == 0) { - std::cerr<<"Problem opening file "< 1) std::cout<<"More than one mesh in "<nommaa,&mdim,&type_maillage, + if (nmaa > 1) cout<<"More than one mesh in "<nommaa,&mdim,&type_maillage, mymailw->maillage_description); if (ret < 0){ - std::cerr<<"Problem MEDmaaInfo in "<nommaa); + edim = MEDdimEspaceLire(fid,mymailw->nommaa); if (!((edim == 3)||(edim == -1))){ - std::cerr<<"Problem dimension Espace should be 3 or -1: "<nommaa,med_2_2::MED_COOR,med_2_2::MED_NOEUD, - (med_2_2::med_geometrie_element)0,(med_2_2::med_connectivite)0); + med_int nnoe=MEDnEntMaa(fid,mymailw->nommaa,MED_COOR,MED_NOEUD, + (med_geometrie_element)0,(med_connectivite)0); if (nnoe<1){ - std::cerr<<"Problem number of Vertices < 1\n"; - ret = med_2_2::MEDfermer(fid); + cerr<<"Problem number of Vertices < 1\n"; + ret = MEDfermer(fid); return false; } //nombre d'objets MED : mailles, faces, aretes , ... - 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; + 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_2_2::med_int nmpolygones,npolyedres,nfpolygones,nfam,nequ,njnt; + 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) std::cout<<"NumberOf"<verbose>6) cout<<"NumberOf"<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); + nbtria3=MEDnEntMaa(fid,mymailw->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); @@ -185,78 +186,78 @@ bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) //npolyedres = lecture_nombre_mailles_polyedres(fid,nommaa,typ_con); //combien de familles ? - nfam=med_2_2::MEDnFam(fid,mymailw->nommaa); + nfam=MEDnFam(fid,mymailw->nommaa); if (mymailw->verbose>2) { - std::cout<<"\nNumberOfFamilies="<nommaa,i+1); + ngro = MEDnGroupe(fid,mymailw->nommaa,i+1); if (ngro < 0){ - std::cerr<<"Problem reading number of groups of family\n"; + cerr<<"Problem reading number of groups of family\n"; continue; } //nombre d'attributs - natt = med_2_2::MEDnAttribut(fid,mymailw->nommaa,i+1); + natt = MEDnAttribut(fid,mymailw->nommaa,i+1); if (natt < 0){ - std::cerr<<"Problem reading number of attributes of family\n"; + cerr<<"Problem reading number of attributes of family\n"; continue; } //nom,numero,attributs,groupes //allocation memoire par exces - 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)); + 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)); - ret = med_2_2::MEDfamInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,attide,attval, - attdes,&natt,gro,&ngro); + ret = MEDfamInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,attide,attval, + attdes,&natt,gro,&ngro); if (ret < 0){ - std::cerr<<"Problem reading informations of family\n"; + cerr<<"Problem reading informations of family\n"; continue; } if (mymailw->verbose>8) { - std::cout<<"Family "<deletegroups)>0) { - //std::cout<<"idelete++ "<0) { //only delete family whith all delete groups - //std::cout<<"famdelete++ "<0) { sgro="Skin_"+sgro; //pas sur que ce soit pertinent } - if (mymailw->verbose>8) std::cout<<"families.add("<verbose>8) cout<<"families.add("<families.add(sfam,sgro); } else { //sgro="Skin_"+sgro; //pas sur que ce soit pertinent - //std::cout<<"--deletegroups matches \""<verbose>3) std::cout<<"--deletegroups matches \""<< + //cout<<"--deletegroups matches \""<verbose>3) cout<<"--deletegroups matches \""<< sgro.toLatin1().constData()<< - "\" in family "<deletegroups)==0){ //sgro="Skin_"+sgro; //pas sur que ce soit pertinent - std::cout<<"families.add("<families.add(sfam,sgro); } else { - std::cout<<"--deletegroups matches \""<verbose>3){ - std::cout<<"\nFamiliesAndGroupsOf "<families.write(); } - med_2_2::med_repere rep; - med_2_2::med_mode_switch mode_coo=med_2_2::MED_FULL_INTERLACE; + med_repere rep; + med_mode_switch mode_coo=MED_FULL_INTERLACE; /* Allocations memoires */ /* table des coordonnees profil : (dimension * nombre de noeuds ) */ - med_2_2::med_float *coo=new med_2_2::med_float[nnoe*mdim]; + med_float *coo=new med_float[nnoe*mdim]; /* table des numeros de familles des noeuds profil : (nombre de noeuds) */ - 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 + med_int *famnodesskin=new med_int[nnoe]; + med_int *pfltab=new med_int[1]; //inutilise car on lit tout //lecture des noeuds : coordonnees - ret=med_2_2::MEDcoordLire(fid,mymailw->nommaa,mdim,coo, + ret=MEDcoordLire(fid,mymailw->nommaa,mdim,coo, mode_coo,MED_ALL, pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo); if (ret < 0){ - std::cerr<<"Problem reading nodes\n"; - ret = med_2_2::MEDfermer(fid); + cerr<<"Problem reading nodes\n"; + ret = MEDfermer(fid); //return false; } - ret=med_2_2::MEDfamLire(fid,mymailw->nommaa,famnodesskin,nnoe,med_2_2::MED_NOEUD,(med_2_2::med_geometrie_element) 0); + ret=MEDfamLire(fid,mymailw->nommaa,famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0); if (ret < 0){ - std::cerr<<"Problem reading families of nodes\n"; - ret = med_2_2::MEDfermer(fid); + cerr<<"Problem reading families of nodes\n"; + ret = MEDfermer(fid); return false; } if (mymailw->verbose>9) { - std::cout<<"\nVertices: no x y z family\n"; + cout<<"\nVertices: no x y z family\n"; for (i=0;inommaa,mdim,conn2,mode_coo, - pfltab,0,med_2_2::MED_MAILLE,med_2_2::MED_SEG2,med_2_2::MED_NOD); + 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); if (ret < 0){ - std::cerr<<"Problem reading MED_SEG2\n"; - ret = med_2_2::MEDfermer(fid); + cerr<<"Problem reading MED_SEG2\n"; + ret = MEDfermer(fid); //return false; } - 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); + med_int *famseg2skin=new med_int[nbseg2]; + ret=MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2); if (ret < 0){ - std::cerr<<"Problem reading families of MED_SEG2\n"; - ret = med_2_2::MEDfermer(fid); + cerr<<"Problem reading families of MED_SEG2\n"; + ret = MEDfermer(fid); return false; } if (mymailw->verbose>9) { - std::cout<<"\nConnectivity MED_SEG2: no node1 node2 family\n"; + cout<<"\nConnectivity MED_SEG2: no node1 node2 family\n"; for (i=0;inommaa,mdim,conn3,mode_coo, - pfltab,0,med_2_2::MED_MAILLE,med_2_2::MED_TRIA3,med_2_2::MED_NOD); + 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); if (ret < 0){ - std::cerr<<"Problem reading MED_TRIA3\n"; - ret = med_2_2::MEDfermer(fid); + cerr<<"Problem reading MED_TRIA3\n"; + ret = MEDfermer(fid); //return false; } - 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); + med_int *famtria3skin=new med_int[nbtria3]; + ret=MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3); if (ret < 0){ - std::cerr<<"Problem reading families of MED_TRIA3\n"; - ret = med_2_2::MEDfermer(fid); + cerr<<"Problem reading families of MED_TRIA3\n"; + ret = MEDfermer(fid); return false; } if (mymailw->verbose>9) { - std::cout<<"\nConnectivity MED_TRIA3: no node1 node2 node3 family\n"; + cout<<"\nConnectivity MED_TRIA3: no node1 node2 node3 family\n"; for (i=0;iverbose>3){ delete[] nufano;*/ if (ifamdelete>0) { - //std::cout<<"!!!!!!!!nodes "<verbose>3){ //if (mymailw->verbose>6) ok=mymailw->list_keys_mesh_wrap(); - ret = med_2_2::MEDfermer(fid); + ret = MEDfermer(fid); if (ret < 0){ - std::cerr<<"Problem closing "<2048){ //delirium in 2008 - std::cerr<<"--number: a positive integer <= 2048 is expected\n\n"; + cerr<<"--number: a positive integer <= 2048 is expected\n\n"; return 1; } if (!cmedname) cmedname=ccasename; @@ -624,11 +622,11 @@ int main(int argc, char *argv[]) tmp=climitswap; limit_swap=tmp.toLong(&ok,10); if (!ok){ - std::cerr<<"--limitswap: an integer is expected. try 1000\n\n"; + cerr<<"--limitswap: an integer is expected. try 1000\n\n"; return 1; } if (limit_swap<1 || limit_swap>32000){ - std::cerr<<"--limitswap: [1->32000] expected. try 1000\n\n"; + cerr<<"--limitswap: [1->32000] expected. try 1000\n\n"; return 1; } } @@ -641,11 +639,11 @@ int main(int argc, char *argv[]) tmp=cverbose; verbose=tmp.toLong(&ok,10); if (!ok){ - std::cerr<<"--verbose: an integer is expected\n\n"; + cerr<<"--verbose: an integer is expected\n\n"; return 1; } if (verbose<0){ - std::cerr<<"--verbose: a positive integer is expected\n\n"; + cerr<<"--verbose: a positive integer is expected\n\n"; return 1; } } @@ -673,12 +671,6 @@ int main(int argc, char *argv[]) tmp=cbackground; if (tmp=="yes") background="yes"; } - - meshholes="no"; //default - if (cmeshholes){ - tmp=cmeshholes; - if (tmp=="yes") meshholes="yes"; - } // We must always have an application @@ -689,7 +681,7 @@ int main(int argc, char *argv[]) m->show(); a.exec(); if ( m->result() == QDialog::Accepted ) { - std::cout<<"parameters "<KeepFiles()<<" "<NbPart()<KeepFiles()<<" "<NbPart()<NbPart(); } else { @@ -705,7 +697,7 @@ int main(int argc, char *argv[]) path="./"; casenamemed=casenamemed.section('/',-1); if (casenamemed.length()>20){ - std::cerr<<"--medname truncated (no more 20 characters)"<20){ - std::cerr<<"--casename truncated (no more 20 characters)"<0) - std::cout<<"tepal2med "< "+path+"tepal.log"; - cmd="tepal -f "+pathini+casename+" -n "+cmd.sprintf("%d",nbfiles); - if (meshholes=="yes") cmd=cmd+" --tetmesh_args \"-c 0\""; - cmd=cmd+" > "+path+"tepal.log"; - std::cout<<"\nlaunchtepal command: background="< "+path+"tepal.log"; + cout<<"\nlaunchtepal command: background="<families.no=1; - //std::cout<<"coucou1 "<families.no<families.no<families.add(casename,casenamemed); format=format.sprintf("%d",nbfiles); int nbf=format.length(); @@ -807,11 +796,16 @@ int main(int argc, char *argv[]) char ctmp[fileskinmed.length()+1] ; strcpy(ctmp,fileskinmed); int res=dumpMED(&ctmp[0],1); }*/ - ok=ReadFileMED(fileskinmed,mymailw); + int ret = access(fileskinmed.toLatin1().constData(),F_OK); //on regarde si le fichier existe + if (ret >= 0) { + ok=ReadFileMED(fileskinmed,mymailw); } + else { + if (verbose>0)cout<<"Initial skin file <"< does not exist\n"; } + //if test read all files before (only small files) if (test=="yes"){ - if (verbose>0) std::cout<<"\nReading output files of tepal as input files of tepal2med...\n"; + if (verbose>0) 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 @@ -819,13 +813,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) std::cout<<"FileName="<0) cout<<"FileName="<ReadFileMSGnew(tmp); } if (verbose>0) - std::cout<<"NumberOfFilesMSGacquired="<nbfiles<<"\n\n"; + cout<<"NumberOfFilesMSGacquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles){ - std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } @@ -838,26 +832,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) std::cout<<"FileName="<0) cout<<"FileName="<0) - std::cout<<"NumberOfFilesMSGAcquired="<nbfiles<<"\n"; + cout<<"NumberOfFilesMSGAcquired="<nbfiles<<"\n"; if (mymailw->nbfiles != nbfiles){ - std::cerr<<"Problem NumberOfFiles != NumberOfFilesAcquired\n"; + cerr<<"Problem NumberOfFiles != NumberOfFilesAcquired\n"; return 1; } if (test=="yes"){ ok=mymailw->test_msg_wrap(); if (ok){ - if (verbose>0) std::cout<<"\nResult_test_msg_wrap=ok\n\n"; + if (verbose>0) cout<<"\nResult_test_msg_wrap=ok\n\n"; } else{ - std::cerr<<"\nResult_test_msg_wrap=NO_OK!\n\n"; + cerr<<"\nResult_test_msg_wrap=NO_OK!\n\n"; return 1; } } @@ -874,7 +868,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) std::cout<<"NumberOfKeysRemoved="<3) cout<<"NumberOfKeysRemoved="<3) ok=mymailw->list_keys_mesh_wrap(); //test read files .noboiteb @@ -887,23 +881,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) std::cout<<"FileName="<0) cout<<"FileName="<ReadFileNOBOITE(tmp); } if (verbose>0) - std::cout<<"NumberOfFilesNOBOITEAcquired="<nbfiles<<"\n"; + cout<<"NumberOfFilesNOBOITEAcquired="<nbfiles<<"\n"; if (mymailw->nbfiles != nbfiles){ - std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; + cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; return 1; } //if (test=="yes"){ ok=mymailw->test_vertices_wrap(); if (ok){ - if (verbose>0) std::cout<<"\nResult_test_vertices_wrap=ok\n\n"; + if (verbose>0) cout<<"\nResult_test_vertices_wrap=ok\n\n"; } else{ - std::cerr<<"\nResult_test_vertices_wrap=NO_OK!\n\n"; + cerr<<"\nResult_test_vertices_wrap=NO_OK!\n\n"; return 1; } //} @@ -913,13 +907,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) std::cout<<"FileName="<0) cout<<"FileName="<ReadFileFACES(tmp); } if (verbose>0) - std::cout<<"NumberOfFilesFACESAcquired="<nbfiles<<"\n\n"; + cout<<"NumberOfFilesFACESAcquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles){ - std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } @@ -929,14 +923,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) std::cout<<"FileName="<0) cout<<"FileName="<ReadFilePOINTS(tmp); } if (verbose>0) - std::cout<<"NumberOfFilesPOINTSAcquired="<nbfiles<<"\n\n"; + cout<<"NumberOfFilesPOINTSAcquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles) { - std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } */ @@ -947,14 +941,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) std::cout<<"FileName="<0) cout<<"FileName="<ReadFileGLO(tmp); //mymailw->SwapOutOfMemory_key_mesh_wrap(QRegExp("GL",true,false)); } if (verbose>0) - std::cout<<"NumberOfFilesGLOAcquired="<nbfiles<<"\n\n"; + cout<<"NumberOfFilesGLOAcquired="<nbfiles<<"\n\n"; if (mymailw->nbfiles != nbfiles){ - std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; } @@ -974,7 +968,7 @@ int main(int argc, char *argv[]) //test remove points (type 3) //nb=mymailw->remove_key_mesh_wrap(QRegExp("PO",true,false)); - //std::cout<<"***remove_key_mesh_wrap*** remove nb="<0)std::cout<3)cout<<"***remove_all_key_mesh_wrap*** "<0)cout<