#include <QFile>
#include <QRegExp>
+#include <limits>
+
+extern "C" {
+#include <med.h>
+//#include <med_config.h>
+//#include <med_utils.h>
+//#include <med_misc.h>
+}
using namespace std;
-using namespace med_2_2;
//utils procedures
fend gb;
fagr::iterator it1;
fend::iterator it2;
- //cout<<"\n***familles.write()***\n";
+ int nbf=0,nbg=0;
for (it1=fam.begin(); it1!=fam.end(); ++it1){
+ nbf++;
cout<<"Family=<"<<(*it1).first.toLatin1().constData()<<">\tGroups=";
gb=(*it1).second;
for (it2=gb.begin(); it2!=gb.end(); ++it2){
}
cout<<endl;
}
+ if (nbf==0) cout<<"no families"<<endl;
for (it1=gro.begin(); it1!=gro.end(); ++it1){
+ nbg++;
cout<<"Group=<"<<(*it1).first.toLatin1().constData()<<">\tFamilies=";
gb=(*it1).second;
for (it2=gb.begin(); it2!=gb.end(); ++it2){
}
cout<<endl;
}
+ if (nbg==0) cout<<"no groups"<<endl;
}
//************************************
Ff>>subnumber;
if (verbose>2) cout<<"NumberOfSubdomains="<<subnumber<<endl;
- tmint=new med_int[subnumber*3];
- for (int i=0; i<subnumber*3; i++) Ff>>tmint[i];
+ //tmint=new med_int[subnumber*3];
+ tmint=new med_int[subnumber*3];
+ long onelong,maxint;
+ maxint=std::numeric_limits<int>::max();
+ //pb from tepalv2
+ bool isproblem=true;
+ for (int i=0; i<subnumber*3; i++) {
+ Ff>>onelong;
+ //pb from tepalv2
+ if (onelong<0) {
+ if (isproblem && verbose>1) cout<<"There is one or more negative med_int value in NumberOfSubdomains "<<onelong<<endl;
+ isproblem=false;
+ onelong=-1;
+ }
+ if (onelong>maxint) {
+ if (isproblem && verbose>1) cout<<"There is one or more truncated med_int value in NumberOfSubdomains "<<onelong<<endl;
+ isproblem=false;
+ onelong=-2;
+ }
+ tmint[i]=(int)onelong;
+ }
if (verbose>4) cout<<"Subdomains "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[subnumber*3-1]<<endl;
montab=new CVWtab(subnumber*3,tmint);
//Version tag
med_int majeur,mineur,release;
//Quelle version de MED est utilis�
- MEDversionDonner(&majeur,&mineur,&release);
+ MEDlibraryNumVersion(&majeur,&mineur,&release);
if (verbose>0) fprintf(stdout,"Files write with MED V%d.%d.%d\n",majeur,mineur,release);
node = xmlNewChild(root_node, 0, BAD_CAST "version",0);
//xmlNewProp(node, BAD_CAST "maj", BAD_CAST int2string2(majeur).c_str());
{
bool ok=true,oktmp;
QString tmp,cmd;
- char description[MED_TAILLE_DESC];
+ char description[MED_COMMENT_SIZE];
+ char dtunit[MED_SNAME_SIZE+1]="_NO_UNIT";
+ char axisname[MED_SNAME_SIZE*3+1]="x y z ";
+ char axisunit[MED_SNAME_SIZE*3+1]="_NO_UNIT _NO_UNIT _NO_UNIT ";
med_int nb;
//remove path
//create file resume DOMAIN.joints.med of all joints for quick display (...may be...)
tmp=path+medname+tmp.sprintf("_joints.med",idom);
- charendnull(distfilename,tmp,MED_TAILLE_DESC);
- fidjoint=MEDouvrir(distfilename,MED_CREATION);
- if (fidjoint<0) cerr<<"Problem MEDouvrir "<<distfilename<<endl;
+ charendnull(distfilename,tmp,MED_COMMENT_SIZE);
+ cout<<"MEDfileOpen "<<distfilename<<endl;
+ fidjoint=MEDfileOpen(distfilename,MED_ACC_CREAT);
+ cout<<"MEDfileOpen fait "<<distfilename<<endl;
+ if (fidjoint<0) cerr<<"Problem MEDfileOpen "<<distfilename<<endl;
if (verbose>0) cout<<"CreateMEDFile for all joints <"<<distfilename<<">\n";
//copy file source/GHS3DPRL_skin.med as destination/DOMAIN.skin.med
if (idom>1) families=intermediatesfamilies;
//if (idom>1) continue;
tmp=path+medname+tmp.sprintf("_%d.med",idom);
- charendnull(distfilename,tmp,MED_TAILLE_DESC);
+ charendnull(distfilename,tmp,MED_COMMENT_SIZE);
//cout<<"<"<<distfilename<<">"<<endl;
- fid=MEDouvrir(distfilename,MED_CREATION);
- if (fid<0) {cerr<<"Problem MEDouvrir "<<distfilename<<endl; goto erreur;}
+ fid=MEDfileOpen(distfilename,MED_ACC_CREAT);
+ if (fid<0) {cerr<<"Problem MEDfileOpen "<<distfilename<<endl; goto erreur;}
if (verbose>0){
if (verbose>2) cout<<endl;
cout<<"CreateMEDFile "<<idom<<" <"<<distfilename<<">\n";
//create mesh
tmp=medname+tmp.sprintf("_%d",idom);
- charendnull(nomfinal,tmp,MED_TAILLE_NOM);
+ charendnull(nomfinal,tmp,MED_NAME_SIZE);
tmp=tmp.sprintf("domain %d among %d",idom,nbfilestot);
- charendnull(description,tmp,MED_TAILLE_DESC);
+ charendnull(description,tmp,MED_COMMENT_SIZE);
if (verbose>4) cout<<"Description : "<<description<<endl;
- err=MEDmaaCr(fid,nomfinal,3,MED_NON_STRUCTURE,description);
- if (err<0) {cerr<<"Problem MEDmaaCr"<<nomfinal<<endl; goto erreur;}
+ err=MEDmeshCr(fid,nomfinal,3,3,MED_UNSTRUCTURED_MESH,description,dtunit,MED_SORT_DTIT,MED_CARTESIAN,axisname,axisunit);
+ if (err<0) {cerr<<"Problem MEDmeshCr"<<nomfinal<<endl; goto erreur;}
if (!idom_nodes()) {cerr<<"Problem on Nodes"<<endl; goto erreur;}
if (!idom_edges()) {cerr<<"Problem on Edges"<<endl; goto erreur;}
nb=create_families(fid,1);
if (verbose>5)cout<<"NumberOfFamiliesNodes="<<nb<<endl;
- err=MEDfamEcr(fid,nomfinal,famnodes,nbnodes,MED_NOEUD,MED_NONE);
+ err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodes,famnodes);
if (verbose>8)
- cout<<"MEDfamEcr nodes "<<nbnodes<<":"<<
+ cout<<"MEDmeshEntityFamilyNumberWr nodes "<<nbnodes<<":"<<
famnodes[0]<<"..."<<famnodes[nbnodes-1]<<" "<<endl;
delete[] famnodes;
- if (err<0) cerr<<"Problem MEDfamEcr nodes"<<endl;
+ if (err<0) cerr<<"Problem MEDmeshEntityFamilyNumberWr nodes"<<endl;
//for others families
nb=create_families(fid,-1);
if (verbose>5)cout<<"NumberOfFamiliesFacesAndEdgesEtc="<<nb<<endl;
- err=MEDfamEcr(fid,nomfinal,famtria3,nbtria3,MED_MAILLE,MED_TRIA3);
+ err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,nbtria3,famtria3);
if (verbose>8)
- cout<<"MEDfamEcr tria3 "<<nbtria3<<":"<<
+ cout<<"MEDmeshEntityFamilyNumberWr tria3 "<<nbtria3<<":"<<
famtria3[0]<<"..."<<famtria3[nbtria3-1]<<" "<<endl;
delete[] famtria3;
- if (err<0) cerr<<"Problem MEDfamEcr tria3"<<endl;
+ if (err<0) cerr<<"Problem MEDmeshEntityFamilyNumberWr tria3"<<endl;
- err=MEDfamEcr(fid,nomfinal,famtetra4,nbtetra4,MED_MAILLE,MED_TETRA4);
+ err=MEDmeshEntityFamilyNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TETRA4,nbtetra4,famtetra4);
if (verbose>8)
- cout<<"MEDfamEcr tetra4 "<<nbtetra4<<":"<<
+ cout<<"MEDmeshEntityFamilyNumberWr tetra4 "<<nbtetra4<<":"<<
famtetra4[0]<<"..."<<famtetra4[nbtria3-1]<<" "<<endl;
delete[] famtetra4;
- if (err<0) cerr<<"Problem MEDfamEcr tria3"<<endl;
+ if (err<0) cerr<<"Problem MEDmeshEntityFamilyNumberWr tria3"<<endl;
- MEDfermer(fid); //no error
+ MEDfileClose(fid); //no error
//master.xml writings
oktmp=Write_masterxmlMEDfile();
continue; //and loop on others domains
erreur: //error
ok=false;
- MEDfermer(fid); //but loop on others domains
+ MEDfileClose(fid); //but loop on others domains
}
- MEDfermer(fidjoint); //no error
+ MEDfileClose(fidjoint); //no error
if (verbose>0)cout<<"\nTotalNumberOftetrahedra="<<nbtetrastotal<<endl;
return ok;
//qt3 xx=this->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"<<endl; return false;}
+ err=MEDmeshNodeCoordinateWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_FULL_INTERLACE,nbnodes,tab->tmflo);
+ if (err<0) {cerr<<"Problem MEDmeshNodeCoordinateWr"<<endl; return false;}
if (verbose>4)cout<<"NumberOfNodes="<<nbnodes<<endl;
//writing indices of nodes
arrayi=new med_int[nbnodes];
for (i=0; i<nbnodes ; i++) arrayi[i]=i+1;
- err=MEDnumEcr(fid,nomfinal,arrayi,nbnodes,MED_NOEUD,MED_NONE);
+ err=MEDmeshEntityNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodes,arrayi);
delete[] arrayi;
- if (err<0) {cerr<<"Problem MEDnumEcr of nodes"<<endl; return false;}
+ if (err<0) {cerr<<"Problem MEDmeshEntityNumberWr of nodes"<<endl; return false;}
key1=key1.sprintf("GL%d VE",idom); //global numerotation
tab1=this->restore_key(key1); //tab1=this->mestab[key1];
// tab3->tmflo[i*3+1],tab3->tmflo[i*3+2])<<endl;
//writing nodes(vertices) global numbering
- err=MEDglobalNumEcr(fid,nomfinal,tab1->tmint,nbnodes,MED_NOEUD,MED_NONE);
- if (err<0){cerr<<"Problem MEDglobalNumEcr nodes"<<endl; return false;}
+ err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodes,tab1->tmint);
+ if (err<0){cerr<<"Problem MEDmeshGlobalNumberWr nodes"<<endl; return false;}
return ok;
}
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=MEDmeshElementConnectivityWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,nbtria3,arrayi);
delete[] arrayi; //need immediately more little array
- if (err<0){cerr<<"Problem MEDconnEcr for triangles connectivity"<<endl; return false;}
+ if (err<0){cerr<<"Problem MEDmeshElementConnectivityWr for triangles connectivity"<<endl; return false;}
//writing indices of faces triangles of wrap
//caution!
//if not in "//writing indices of tetrahedra" -> arrayi[i]=!NBFACES!+i+1
arrayi=new med_int[nbtria3];
for (i=0; i<nbtria3 ; i++) arrayi[i]=nbseg2+i+1;
- err=MEDnumEcr(fid,nomfinal,arrayi,nbtria3,MED_MAILLE,MED_TRIA3);
+ err=MEDmeshEntityNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,nbtria3,arrayi);
delete[] arrayi;
- if (err<0){cerr<<"Problem MEDnumEcr of triangles"<<endl; return false;}
+ if (err<0){cerr<<"Problem MEDmeshEntityNumberWr of triangles"<<endl; return false;}
//GLx FA=files.GLo FAces
key1=key1.sprintf("GL%d FA",idom);
//writing faces(triangles) global numbering
if (verbose>2)
cout<<"CreateMEDglobalNumerotation_Faces "<<key1.toLatin1().constData()<<" "<<tab1->size<<endl;
- err=MEDglobalNumEcr(fid,nomfinal,tab1->tmint,tab1->size,MED_MAILLE,MED_TRIA3);
- if (err<0){cerr<<"Problem MEDglobalNumEcr faces"<<endl; return false;}
+ err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,tab1->size,tab1->tmint);
+ if (err<0){cerr<<"Problem MEDmeshGlobalNumberWr faces"<<endl; return false;}
//xx=this->remove_key_mesh_wrap(QRegExp("FC*",true,true));
tmp=tmp.sprintf("GL%d FA",idom);
CVWtab *tab,*tab1,*tab2;
med_int ineig,ii,jj,i,j,k,*arrayi,nb,famjoint,*fammore,*inodes,*arrayfaces;
med_float *arraynodes;
- char namejnt[MED_TAILLE_NOM+1]; //no more 32
- char namedist[MED_TAILLE_NOM+1];
- char descjnt[MED_TAILLE_DESC+1];
+ char namejnt[MED_NAME_SIZE+1]; //no more 32
+ char namedist[MED_NAME_SIZE+1];
+ char descjnt[MED_COMMENT_SIZE+1];
med_int numfam_ini_wrap=100;
joints_node=xmlNewNode(NULL, BAD_CAST "joints"); //masterfile.xml
med_int nbjoints=0,nbnodesneig,nbtria3neig;
string sjoints=""; //which domains are neighbourg
int xx;
+ char dtunit[MED_SNAME_SIZE+1]="_NO_UNIT";
+ char axisname[MED_SNAME_SIZE*3+1]="x y z ";
+ char axisunit[MED_SNAME_SIZE*3+1]="_NO_UNIT _NO_UNIT _NO_UNIT ";
tmp=tmp.sprintf("MS%d *",idom);
//read file .msg if not done
strcpy(descjnt,tmp.toLatin1().constData());
tmp=medname+tmp.sprintf("_%d",ineig);
strcpy(namedist,tmp.toLatin1().constData());
- err=MEDjointCr(fid,nomfinal,namejnt,descjnt,ineig,namedist);
- if (err<0) cerr<<"Problem MEDjointCr"<<endl;
+ err=MEDsubdomainJointCr(fid,nomfinal,namejnt,descjnt,ineig,namedist);
+ if (err<0) cerr<<"Problem MEDsubdomainJointCr"<<endl;
famjoint=0;
if (namejoint.contains(deletegroups)==0){
}
delete[] fammore;
- err=MEDjointEcr(fid,nomfinal,namejnt,arrayi,nb,
- MED_NOEUD,MED_NONE,MED_NOEUD,MED_NONE);
- if (err<0) cerr<<"Problem MEDjointEcr nodes"<<endl;
+ err=MEDsubdomainCorrespondenceWr(fid,nomfinal,namejnt,MED_NO_DT,MED_NO_IT,
+ MED_NODE,MED_UNDEF_GEOMETRY_TYPE,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nb,arrayi);
+ if (err<0) cerr<<"Problem MEDsubdomainCorrespondenceWr nodes"<<endl;
delete[] arrayi;
//!*************TRIA3
}
delete[] fammore;
- err=MEDjointEcr(fid,nomfinal,namejnt,arrayi,nb,MED_MAILLE,MED_TRIA3,MED_MAILLE,MED_TRIA3);
- if (err<0) cerr<<"Problem MEDjointEcr triangles"<<endl;
+ err=MEDsubdomainCorrespondenceWr(fid,nomfinal,namejnt,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_TRIA3,MED_CELL,MED_TRIA3,nb,arrayi);
+ if (err<0) cerr<<"Problem MEDsubdomainCorrespondenceWr triangles"<<endl;
delete[] arrayi;
}
if (idom<=ineig) { //no duplicate joint_1_2 and joint_2_1
//create mesh
namejoint=namejoint.sprintf("JOINT_%d_%d",idom,ineig);
- charendnull(namejnt,namejoint,MED_TAILLE_NOM);
+ charendnull(namejnt,namejoint,MED_NAME_SIZE);
tmp=tmp.sprintf("joint between %d and %d",idom,ineig);
- charendnull(descjnt,tmp,MED_TAILLE_DESC);
- err=MEDmaaCr(fidjoint,namejnt,3,MED_NON_STRUCTURE,descjnt);
- if (err<0) cerr<<"Problem MEDmaaCr "<<namejnt<<endl;
+ charendnull(descjnt,tmp,MED_COMMENT_SIZE);
+ err=MEDmeshCr(fidjoint,namejnt,3,3,MED_UNSTRUCTURED_MESH,descjnt,dtunit,MED_SORT_DTIT,MED_CARTESIAN,axisname,axisunit);
+ if (err<0) cerr<<"Problem MEDmeshCr "<<namejnt<<endl;
//write nodes
- err=MEDcoordEcr(fidjoint,namejnt,3,arraynodes,MED_FULL_INTERLACE,
- nbnodesneig,MED_CART,nomcoo,unicoo);
- if (err<0) cerr<<"Problem MEDcoordEcr "<<namejnt<<endl;
+ err=MEDmeshNodeCoordinateWr(fidjoint,namejnt,MED_NO_DT,MED_NO_IT,0.,MED_FULL_INTERLACE,nbnodesneig,arraynodes);
+ if (err<0) cerr<<"Problem MEDmeshNodeCoordinateWr "<<namejnt<<endl;
arrayi=new med_int[nbnodesneig];
for (i=0; i<nbnodesneig ; i++) arrayi[i]=i+1;
- err=MEDnumEcr(fidjoint,namejnt,arrayi,nbnodesneig,MED_NOEUD,MED_NONE);
+ err=MEDmeshEntityNumberWr(fidjoint,namejnt,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodesneig,arrayi);
delete[] arrayi;
- if (err<0) cerr<<"Problem MEDnumEcr of nodes "<<namejnt<<endl;
+ if (err<0) cerr<<"Problem MEDmeshEntityNumberWr of nodes "<<namejnt<<endl;
//write tria3
if (nbtria3neig>0) {
//for (i=0; i<nbtria3neig ; i++) cout<<i+1<<" "<<
// arrayfaces[i*3]<<" "<<arrayfaces[i*3+1]<<" "<<arrayfaces[i*3+2]<<endl;
- err=MEDconnEcr(fidjoint,namejnt,3,arrayfaces,MED_FULL_INTERLACE,
- nbtria3neig,MED_MAILLE,MED_TRIA3,MED_NOD);
- if (err<0) cerr<<"Problem MEDconnEcr for triangles connectivity "<<namejnt<<endl;
+ err=MEDmeshElementConnectivityWr(fidjoint,namejnt,MED_NO_DT,MED_NO_IT,0.,
+ MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,nbtria3neig,arrayfaces);
+ if (err<0) cerr<<"Problem MEDmeshElementConnectivityWr for triangles connectivity "<<namejnt<<endl;
//writing indices of faces triangles of joint
arrayi=new med_int[nbtria3neig];
for (i=0; i<nbtria3neig ; i++) arrayi[i]=i+1;
- err=MEDnumEcr(fidjoint,namejnt,arrayi,nbtria3neig,MED_MAILLE,MED_TRIA3);
+ err=MEDmeshEntityNumberWr(fidjoint,namejnt,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,nbtria3neig,arrayi);
delete[] arrayi;
- if (err<0) cerr<<"Problem MEDnumEcr of triangles "<<namejnt<<endl;
+ if (err<0) cerr<<"Problem MEDmeshEntityNumberWr of triangles "<<namejnt<<endl;
}
}
nbtetra4=tab1->size/4;
nbtetrastotal=nbtetrastotal + nbtetra4;
if (verbose>5)cout<<"NumberOftetrahedra="<<nbtetra4<<endl;
- err=MEDconnEcr(fid,nomfinal,3,tab1->tmint,MED_FULL_INTERLACE,nbtetra4,MED_MAILLE,MED_TETRA4,MED_NOD);
- if (err<0){cerr<<"Problem MEDconnEcr for tetra connectivity"<<endl; return false;}
+ err=MEDmeshElementConnectivityWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,0.,MED_CELL,MED_TETRA4,MED_NODAL,MED_FULL_INTERLACE,nbtetra4,tab1->tmint);
+ if (err<0){cerr<<"Problem MEDmeshElementConnectivityWr for tetra connectivity"<<endl; return false;}
//writing indices of tetrahedra
arrayi=new med_int[nbtetra4];
for (i=0; i<nbtetra4 ; i++) arrayi[i]=nbseg2+nbtria3+i+1;
//for (i=0; i<nbtria3 ; i++) cout<<i<<" "<<arrayi[i]<<endl;
- err=MEDnumEcr(fid,nomfinal,arrayi,nbtetra4,MED_MAILLE,MED_TETRA4);
+ err=MEDmeshEntityNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TETRA4,nbtetra4,arrayi);
delete[] arrayi;
- if (err<0){cerr<<"Problem MEDnumEcr of tetrahedra"<<endl; return false;}
+ if (err<0){cerr<<"Problem MEDmeshEntityNumberWr of tetrahedra"<<endl; return false;}
famtetra4=new med_int[nbtetra4];
for (i=0; i<nbtetra4 ; i++) famtetra4[i]=famnewtetra4;
cerr<<"Problem incorrect size of tetrahedra global numbering"<<endl; return false;}
if (verbose>2)
cout<<"CreateMEDglobalNumerotation_tetrahedra "<<key1.toLatin1().constData()<<" "<<tab1->size<<endl;
- err=MEDglobalNumEcr(fid,nomfinal,tab1->tmint,tab1->size,MED_MAILLE,MED_TETRA4);
- if (err<0){cerr<<"Problem MEDglobalNumEcr tetrahedra"<<endl; return false;}
+ err=MEDmeshGlobalNumberWr(fid,nomfinal,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TETRA4,tab1->size,tab1->tmint);
+ if (err<0){cerr<<"Problem MEDmeshGlobalNumberWr tetrahedra"<<endl; return false;}
tmp=tmp.sprintf("NB%d EV",idom);
//qt3 xx=this->remove_key_mesh_wrap(QRegExp(tmp,true,true));
//if sign >= 0 family zero and family nodes
{
med_int pas,ires;
- char nomfam[MED_TAILLE_NOM+1]; //it.current()->name;
- char attdes[MED_TAILLE_DESC+1]="_NO_DESCRIPTION";
+ char nomfam[MED_NAME_SIZE+1]; //it.current()->name;
+ char attdes[MED_COMMENT_SIZE+1]="_NO_DESCRIPTION";
char *gro;
med_int i,attide=1,attval=1,natt=1,num,ngro;
num=(*it1).first.toLong();
if ((pas==-1) && (num>=0)) continue; //not good families
if ((pas== 1) && (num< 0)) continue; //not good families
- charendnull(nomfam,(*it1).first,MED_TAILLE_NOM);
+ charendnull(nomfam,(*it1).first,MED_NAME_SIZE);
ires++;
//med_int natt=0;
ngro=(*it1).second.size();
if (verbose>5)
cout<<"CreateFamilyInMEDFile <"<<nomfam<<">\tNbGroups="<<ngro;
- gro=new char[MED_TAILLE_LNOM*ngro+2];
+ gro=new char[MED_LNAME_SIZE*ngro+2];
gb=(*it1).second;
i=0;
for (it2=gb.begin(); it2!=gb.end(); ++it2){
- charendnull(&gro[i*MED_TAILLE_LNOM],(*it2).first,MED_TAILLE_LNOM);
- if (verbose>5)cout<<" <"<<&gro[i*MED_TAILLE_LNOM]<<"> ";
+ charendnull(&gro[i*MED_LNAME_SIZE],(*it2).first,MED_LNAME_SIZE);
+ if (verbose>5)cout<<" <"<<&gro[i*MED_LNAME_SIZE]<<"> ";
i++;
}
if (verbose>5)cout<<endl;
- err=MEDfamCr(fid,nomfinal,nomfam,num,NULL,NULL,NULL,0,gro,ngro);
- //&attide,&attval,attdes,natt,gro,ngro);
- if (err<0) cerr<<"Problem MEDfamCr"<<endl;
+ err=MEDfamilyCr(fid,nomfinal,nomfam,num,ngro,gro);
+ if (err<0) cerr<<"Problem MEDfamilyCr"<<endl;
delete[] gro;
- if (err<0) cerr<<"Problem MEDfamCr of "<<nomfam<<endl;
+ if (err<0) cerr<<"Problem MEDfamilyCr of "<<nomfam<<endl;
}
return ires;
}
#include <libxml/xpathInternals.h>
//Med File V 2.2 attributes
-#undef MED_H
-#undef MED_PROTO_H
-namespace med_2_2 {
+//#undef MED_H
+//#undef MED_PROTO_H
+
extern "C" {
#include <med.h>
-#include <med_proto.h>
+//#include <med_proto.h>
}
-}
class CVWtab
//contains size=size of vector and the vector (med_int or med_float)
static long memoryuse;
static long memorymax;
long size,type;
- med_2_2::med_int *tmint; //integer med
- med_2_2::med_float *tmflo; //float med
+ med_int *tmint; //integer med
+ med_float *tmflo; //float med
QString filename;
- CVWtab(long nb, med_2_2::med_int *pmint);
- CVWtab(long nb, med_2_2::med_float *pmflo);
+ CVWtab(long nb, med_int *pmint);
+ CVWtab(long nb, med_float *pmflo);
~CVWtab();
bool CVWtab_deallocate();
bool is_equal(CVWtab *tab2);
xmlNodePtr xml_groups();
void add(QString nomfam, QString nomgro);
void addgro();
- bool get_number_of_new_family(int sign,med_2_2::med_int *num,QString *tmp);
- med_2_2::med_int find_family_on_groups(med_2_2::med_int fam1, med_2_2::med_int fam2);
- fend fuse_goups(med_2_2::med_int fam1, med_2_2::med_int fam2);
+ bool get_number_of_new_family(int sign,med_int *num,QString *tmp);
+ med_int find_family_on_groups(med_int fam1, med_int fam2);
+ fend fuse_goups(med_int fam1, med_int fam2);
};
class ghs3dprl_mesh_wrap
nofile,nbfiles,nbfilestot,
nbelem_limit_swap,
verbose;
- med_2_2::med_err err;
- med_2_2::med_idt fid,fidjoint;
- med_2_2::med_int idom;
+ med_err err;
+ med_idt fid,fidjoint;
+ med_int idom;
//master.xml
std::string filemaster,domainname;
- char distfilename[MED_TAILLE_DESC];
+ char distfilename[MED_COMMENT_SIZE];
xmlDocPtr master_doc;
xmlNodePtr root_node,node,node2,
joints_node,info_node,files_node,mesh_node;
familles families;
//from skin.med
- char nommaa[MED_TAILLE_NOM+1];
- char maillage_description[MED_TAILLE_DESC+1];
- char nomcoo[3*MED_TAILLE_PNOM+1];
- char unicoo[3*MED_TAILLE_PNOM+1];
- med_2_2::med_int *famnodesskin; //from skin.med...
- med_2_2::med_int *famseg2skin; //...valid on global index/numerotation
- med_2_2::med_int *famtria3skin;
+ char nommaa[MED_NAME_SIZE+1];
+ char maillage_description[MED_COMMENT_SIZE+1];
+ char nomcoo[3*MED_SNAME_SIZE+1];
+ char unicoo[3*MED_SNAME_SIZE+1];
+ med_int *famnodesskin; //from skin.med...
+ med_int *famseg2skin; //...valid on global index/numerotation
+ med_int *famtria3skin;
//to final files .med with tetrahedra
- char nomfinal[MED_TAILLE_NOM+1];
- med_2_2::med_int *famnodes,nbnodes,famnewnodes,famallnodes; //to final files .med with tetrahedra
- med_2_2::med_int *famseg2,nbseg2,famnewseg2,famallseg2;
- med_2_2::med_int *famtria3,nbtria3,famnewtria3,famalltria3;
- med_2_2::med_int *famtetra4,nbtetra4,famnewtetra4,famalltetra4;
+ char nomfinal[MED_NAME_SIZE+1];
+ med_int *famnodes,nbnodes,famnewnodes,famallnodes; //to final files .med with tetrahedra
+ med_int *famseg2,nbseg2,famnewseg2,famallseg2;
+ med_int *famtria3,nbtria3,famnewtria3,famalltria3;
+ med_int *famtetra4,nbtetra4,famnewtetra4,famalltetra4;
//low level
bool list_keys_mesh_wrap(); //list keys
CVWtab* restore_key(const QString &key);
//family level
- bool set_one_more_family(med_2_2::med_int *fami, med_2_2::med_int *more, med_2_2::med_int nb);
- med_2_2::med_int create_families(med_2_2::med_idt fid,int sign);
- void add_family(med_2_2::med_int num,QString newgro);
+ bool set_one_more_family(med_int *fami, med_int *more, med_int nb);
+ med_int create_families(med_idt fid,int sign);
+ void add_family(med_int num,QString newgro);
void cout_families_and_groups();
bool idom_nodes();
bool idom_edges();
//************************************
bool ghs3dprl_msg_parser::startElement(const QString &namespaceURI,
- const QString &localName,
- const QString &qName,
- const QXmlAttributes &attrs)
+ const QString &localName,
+ const QString &qName,
+ const QXmlAttributes &attrs)
{
bool ok;
if (verbose) std::cout<<indent.toLatin1().constData()<<qName.toLatin1().constData()<<std::endl;
//************************************
bool ghs3dprl_msg_parser::endElement(const QString &namespaceURI,
- const QString &localName,
- const QString &qName)
+ const QString &localName,
+ const QString &qName)
{
indent.remove((uint)0,3);
if (verbose) std::cout<<indent.toLatin1().constData()<<"\\"<<qName.toLatin1().constData()<<std::endl;
bool ghs3dprl_msg_parser::characters(const QString &strini)
{
bool ok;
- med_2_2::med_int *tmint=NULL;
+ med_int *tmint=NULL;
long nb=0;
//filtre rc,lf,tab et blancs successifs
QString str=strini.simplified();
double ver=str.toDouble(&ok);
if (!ok || ver!=1e0)
{
- std::cout<<"version "<<str.toLatin1().constData()<<" fichier .msg inconnue"<<std::endl;
- return false;
+ std::cout<<"version "<<str.toLatin1().constData()<<" fichier .msg inconnue"<<std::endl;
+ return false;
}
else return true;
}
{
//lecture vecteurs d'entiers separateur blanc
long i=0;
- tmint=new med_2_2::med_int[nb];
+ tmint=new med_int[nb];
//printf("%staille attendue=%i taille vue=%i\n",(const char *)indent.toLatin1().constData(),nbcount,nb);
do
{
- tmint[i]=str.section(' ',i,i).toLong(&ok);
- //printf("tmint[%i]=%i\n",i,tmint[i]);
- i++;
+ tmint[i]=str.section(' ',i,i).toLong(&ok);
+ //printf("tmint[%i]=%i\n",i,tmint[i]);
+ i++;
} while ((i<nb) && ok );
if (i<nb)
{
- std::cout<<"pb conversion "<<i<<" eme entier="<<str.section(' ',i-1,i-1).toLatin1().constData()<<std::endl;
- std::cout<<indent.toLatin1().constData()<<"etat="<<etat<<" nb="<<nb<<std::endl<<str.toLatin1().constData()<<std::endl;
+ std::cout<<"pb conversion "<<i<<" eme entier="<<str.section(' ',i-1,i-1).toLatin1().constData()<<std::endl;
+ std::cout<<indent.toLatin1().constData()<<"etat="<<etat<<" nb="<<nb<<std::endl<<str.toLatin1().constData()<<std::endl;
}
}
if (nb==1)
{
- tmint=new med_2_2::med_int[nb];
+ tmint=new med_int[nb];
tmint[0]=str.toLong(&ok);
if (!ok)
{
- std::cout<<"pb conversion 1er entier="<<str.toLatin1().constData()<<std::endl;
- std::cout<<indent.toLatin1().constData()<<"etat="<<etat<<" nb="<<nb<<std::endl;
+ std::cout<<"pb conversion 1er entier="<<str.toLatin1().constData()<<std::endl;
+ std::cout<<indent.toLatin1().constData()<<"etat="<<etat<<" nb="<<nb<<std::endl;
}
}
" neighbour="<<neighbourindice<<
" file="<<mailw->nofile<<std::endl;*/
tmp=tmp.sprintf("MS%ld NE%ld ",
- mailw->nofile,neighbourindice)+
- shorttypel+shortsendreceive;
+ mailw->nofile,neighbourindice)+
+ shorttypel+shortsendreceive;
tmp=tmp.simplified();
ok=mailw->insert_key(tmp,montab);
return true;
#include <stdio.h> /* printf clrscr fopen fread fwrite fclose */
#include <string>
#include <cstring>
+#include <cstdlib>
#include <iostream>
#include <sstream>
#include <fstream>
#include <qstring.h>
+
#include <QXmlSimpleReader>
#include <QXmlInputSource>
#include <QApplication>
//#include <med_config.h>
//#include <med_utils.h>
//#include <med_misc.h>
-#include <stdlib.h>
}
using namespace std;
-using namespace med_2_2;
//************************************
med_idt ouvre_fichier_MED(char *fichier,int verbose)
if (ret < 0) return fid;
/* on regarde s'il s'agit d'un fichier au format HDF5 */
- ret = MEDformatConforme(fichier);
+ med_bool hdfok,medok;
+ ret = MEDfileCompatibility(fichier,&hdfok,&medok);
if (ret < 0){
- cerr<<"File "<<fichier<<" not HDF V5 formatted\n";
+ cerr<<"File "<<fichier<<" not MED or HDF V5 formatted\n";
return fid;
}
/* Quelle version de MED est utilise par mdump ? */
- MEDversionDonner(&majeur,&mineur,&release);
+ MEDlibraryNumVersion(&majeur,&mineur,&release);
if (verbose>0)fprintf(stdout,"\nReading %s with MED V%d.%d.%d",
fichier,majeur,mineur,release);
/* Ouverture du fichier MED en lecture seule */
- fid = MEDouvrir(fichier,MED_LECTURE);
+ fid = MEDfileOpen(fichier,MED_ACC_RDONLY);
if (ret < 0) return fid;
- MEDversionLire(fid, &majeur, &mineur, &release);
+ MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
if (majeur < 2 || majeur == 2 && mineur < 2) {
fprintf(stderr,"File %s from MED V%d.%d.%d not assumed\n",
fichier,majeur,mineur,release);
//" version est ant�ieure �la version 2.2";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
fid=0; }
else {
if (verbose>0)fprintf(stdout,", file from MED V%d.%d.%d\n",majeur,mineur,release); }
{
med_err ret;
med_idt fid=0;
- med_int i,j,mdim,nmaa,edim,majeur_lu,mineur_lu,release_lu,nprofils;
- med_maillage type_maillage;
+ med_int i,j,sdim,mdim,nmaa,edim,majeur_lu,mineur_lu,release_lu,nprofils,nstep;
+ med_mesh_type type_maillage;
+ char dtunit[MED_SNAME_SIZE+1];
+ char axisname[MED_SNAME_SIZE+1];
+ char axisunit[MED_SNAME_SIZE*3+1];
+ med_sorting_type sortingtype;
+ med_axis_type axistype;
int numero=1;
- med_connectivite typ_con=MED_NOD;
QString key,tmp;
-
+ med_bool chan;
+ med_bool tran;
+
//version qt3
char chaine[nomfilemed.length()+1];
strncpy(chaine,nomfilemed.toLatin1().constData(),nomfilemed.length()+1);
//cout<<"*** ReadFileMED *** "<<chaine<<"\n";
- /*version qt4
- char chaine[nomfilemed.length() + 1];
- strncpy(chaine, nomfilemed.toStdString().c_str(), nomfilemed.length());
- //?chaine[nomfilemed.length()]= '\0';
- cout<<"fichier "<<chaine<<"\n";*/
-
- //char *pt=chaine;
fid=ouvre_fichier_MED(chaine,mymailw->verbose);
if (fid == 0) {
cerr<<"Problem opening file "<<nomfilemed.toLatin1().constData()<<"\n";
- //ret = MEDfermer(fid);
return false;
}
- nmaa = MEDnMaa(fid);
+ nmaa = MEDnMesh(fid);
if (nmaa <= 0){
cerr<<"No meshes in "<<nomfilemed.toLatin1().constData()<<"\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
return false;
}
if (nmaa > 1) cout<<"More than one mesh in "<<nomfilemed.toLatin1().constData()<<", first one taken\n";
- ret = MEDmaaInfo(fid,numero,mymailw->nommaa,&mdim,&type_maillage,
- mymailw->maillage_description);
+ ret = MEDmeshInfo(fid,numero,mymailw->nommaa,&sdim,&mdim,&type_maillage,mymailw->maillage_description,
+ dtunit,&sortingtype,&nstep,&axistype,axisname,axisunit);
if (ret < 0){
- cerr<<"Problem MEDmaaInfo in "<<nomfilemed.toLatin1().constData()<<"\n";
- ret = MEDfermer(fid);
+ cerr<<"Problem MEDmeshInfo in "<<nomfilemed.toLatin1().constData()<<"\n";
+ ret = MEDfileClose(fid);
return false;
}
if (mdim != 3){
- cerr<<"Problem dimension mesh should be 3: "<<mdim<<"\n";
- ret = MEDfermer(fid);
+ cerr<<"Problem mesh dimension should be 3: "<<mdim<<"\n";
+ ret = MEDfileClose(fid);
return false;
}
- edim = MEDdimEspaceLire(fid,mymailw->nommaa);
- if (!((edim == 3)||(edim == -1))){
- cerr<<"Problem dimension Espace should be 3 or -1: "<<edim<<"\n";
- ret = MEDfermer(fid);
+ if (sdim != 3){
+ cerr<<"Problem space dimension should be 3: "<<sdim<<"\n";
+ ret = MEDfileClose(fid);
return false;
}
- if (type_maillage != MED_NON_STRUCTURE){
+ if (type_maillage != MED_UNSTRUCTURED_MESH){
cerr<<"Problem type mesh should be MED_NON_STRUCTURE: "<<type_maillage<<endl;
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
return false;
}
//lecture nb de noeuds
- med_int nnoe=MEDnEntMaa(fid,mymailw->nommaa,MED_COOR,MED_NOEUD,
- (med_geometrie_element)0,(med_connectivite)0);
+ //cf med-3.0.0_install/share/doc/html/maillage_utilisateur.html
+ med_int nnoe=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_NODE,MED_NO_GEOTYPE,MED_COORDINATE,MED_NO_CMODE,&chan,&tran);
+ //(med_geometrie_element)0,(med_connectivite)0);
if (nnoe<1){
cerr<<"Problem number of Vertices < 1\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
return false;
}
//nombre d'objets MED : mailles, faces, aretes , ...
- med_int nmailles[MED_NBR_GEOMETRIE_MAILLE],nbtria3;
- med_int nfaces[MED_NBR_GEOMETRIE_FACE];
- med_int naretes[MED_NBR_GEOMETRIE_ARETE],nbseg2;
+ med_int nmailles[MED_N_CELL_GEO],nbtria3;
+ med_int nfaces[MED_N_FACE_GEO];
+ med_int naretes[MED_N_EDGE_FIXED_GEO],nbseg2;
+ //med_int nmailles[MED_NBR_GEOMETRIE_MAILLE],nbtria3;
+ //med_int nfaces[MED_NBR_GEOMETRIE_FACE];
+ //med_int naretes[MED_NBR_GEOMETRIE_ARETE],nbseg2;
//polygones et polyedres familles equivalences joints
med_int nmpolygones,npolyedres,nfpolygones,nfam,nequ,njnt;
//lecture_nombre_mailles_standards(fid,nommaa,typmai[i],typ_con,i);
if (mymailw->verbose>6) cout<<"NumberOf"<<nommai[i]<<"="<<nmailles[i]<<endl;
}*/
- 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);
- //Combien de mailles polyedres quelconques ?
- //npolyedres = lecture_nombre_mailles_polyedres(fid,nommaa,typ_con);
+
+ nbtria3=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_TRIA3,MED_CONNECTIVITY,MED_NODAL,&chan,&tran);
+ nbseg2=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_SEG2,MED_CONNECTIVITY,MED_NODAL,&chan,&tran);
//combien de familles ?
- nfam=MEDnFam(fid,mymailw->nommaa);
+ nfam=MEDnFamily(fid,mymailw->nommaa);
if (mymailw->verbose>2) {
cout<<"\nNumberOfFamilies="<<nfam<<endl;
cout<<"NumberOfVertices="<<nnoe<<endl;
}
if (nbtria3<3){
cerr<<"Problem number of MED_TRIA3 < 3, not a skin of a volume\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
return false;
}
med_int famdelete[nfam],ifamdelete=0,idelete;
{
- med_int natt,ngro;
- char *attdes,*gro;
- med_int *attval,*attide;
- char nomfam[MED_TAILLE_NOM+1];
+ med_int ngro;
+ char *gro;
+ char nomfam[MED_NAME_SIZE+1];
med_int numfam;
- char str1[MED_TAILLE_DESC+1];
- char str2[MED_TAILLE_LNOM+1];
+ char str1[MED_COMMENT_SIZE+1];
+ char str2[MED_LNAME_SIZE+1];
med_err ret = 0;
for (i=0;i<nfam;i++) famdelete[i]=0;
for (i=0;i<nfam;i++) {
//nombre de groupes
- ngro = MEDnGroupe(fid,mymailw->nommaa,i+1);
+ ngro = MEDnFamilyGroup(fid,mymailw->nommaa,i+1);
if (ngro < 0){
cerr<<"Problem reading number of groups of family\n";
continue;
}
- //nombre d'attributs
- natt = MEDnAttribut(fid,mymailw->nommaa,i+1);
- if (natt < 0){
- cerr<<"Problem reading number of attributes of family\n";
- continue;
- }
-
- //nom,numero,attributs,groupes
+ //atributs obsolete MED3
//allocation memoire par exces
- attide = (med_int*) malloc(sizeof(med_int)*(natt+1));
- attval = (med_int*) malloc(sizeof(med_int)*(natt+1));
- attdes = (char *) malloc(MED_TAILLE_DESC*(natt+1));
- gro = (char*) malloc(MED_TAILLE_LNOM*(ngro+1));
+ gro = (char*) malloc(MED_LNAME_SIZE*(ngro+1));
- ret = MEDfamInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,attide,attval,
- attdes,&natt,gro,&ngro);
+ ret = MEDfamilyInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,gro);
if (ret < 0){
cerr<<"Problem reading informations of family\n";
continue;
}
if (mymailw->verbose>8) {
- cout<<"Family "<<numfam<<" have "<<natt<<" attributes and "<<ngro<<" groups\n";
+ cout<<"Family "<<numfam<<" have "<<ngro<<" groups\n";
//affichage des resultats
- for (j=0;j<natt;j++) {
- if (j==0) cout<<" Attributes :\n";
- strncpy(str1,attdes+j*MED_TAILLE_DESC,MED_TAILLE_DESC);
- str1[MED_TAILLE_DESC] = '\0';
- fprintf(stdout," ident = %d\t value = %d\t description = %s\n",
- *(attide+j),*(attval+j),str1);
- }
for (j=0;j<ngro;j++) {
if (j==0) cout<<" Groups :\n";
- strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM] = '\0';
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE] = '\0';
fprintf(stdout," name = %s\n",str2);
}
if (i==nfam-1) cout<<endl;
sfam=sfam.sprintf("%d",numfam);
idelete=0;
for (j=0;j<ngro;j++){
- strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM]='\0';
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE]='\0';
sgro=str2;
if (sgro.contains(mymailw->deletegroups)>0) {
//cout<<"idelete++ "<<sgro<<endl;
else {
for (j=0;j<ngro;j++){
- strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM]='\0';
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE]='\0';
sgro=str2;
QRegExp qgroup=QRegExp("Group_Of_All",Qt::CaseSensitive,QRegExp::RegExp);
if (sgro.contains(mymailw->deletegroups)==0){
}
/*for (j=0;j<ngro;j++){
- strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM]='\0';
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE]='\0';
sgro=str2;
//cout<<"families.add("<<sfam<<","<<sgro<<")\n";
if (sgro.contains(mymailw->deletegroups)==0){
}*/
//on libere la memoire
- free(attide);
- free(attval);
- free(attdes);
free(gro);
}
}
cout<<"\nFamiliesAndGroupsOf "<<nomfilemed.toLatin1().constData()<<endl;
mymailw->families.write();
}
-
- med_repere rep;
- med_mode_switch mode_coo=MED_FULL_INTERLACE;
-
/* Allocations memoires */
- /* table des coordonnees profil : (dimension * nombre de noeuds ) */
- med_float *coo=new med_float[nnoe*mdim];
+ /* table des coordonnees profil : (space dimension * nombre de noeuds ) */
+ med_float *coo=new med_float[nnoe*sdim];
/* table des numeros de familles des noeuds profil : (nombre de noeuds) */
med_int *famnodesskin=new med_int[nnoe];
med_int *pfltab=new med_int[1]; //inutilise car on lit tout
//lecture des noeuds : coordonnees
- ret=MEDcoordLire(fid,mymailw->nommaa,mdim,coo,
- mode_coo,MED_ALL,
- pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo);
+ ret=MEDmeshNodeCoordinateRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_FULL_INTERLACE,coo);
+ //mdim,coo,mode_coo,MED_ALL,pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo);
if (ret < 0){
cerr<<"Problem reading nodes\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
//return false;
}
- ret=MEDfamLire(fid,mymailw->nommaa,famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0);
+ ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,famnodesskin);
+ //famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0);
if (ret < 0){
cerr<<"Problem reading families of nodes\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
return false;
}
if (mymailw->verbose>9) {
}
med_int *conn2=new med_int[nbseg2*2];
- ret=MEDconnLire(fid,mymailw->nommaa,mdim,conn2,mode_coo,
- pfltab,0,MED_MAILLE,MED_SEG2,MED_NOD);
+ ret=MEDmeshElementConnectivityRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_SEG2,MED_NODAL,MED_FULL_INTERLACE,conn2);
+ //mdim,conn2,mode_coo,pfltab,0,MED_MAILLE,MED_SEG2,MED_NOD);
if (ret < 0){
cerr<<"Problem reading MED_SEG2\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
//return false;
}
med_int *famseg2skin=new med_int[nbseg2];
- ret=MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2);
+ ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_SEG2,famseg2skin);
+ //MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2);
if (ret < 0){
cerr<<"Problem reading families of MED_SEG2\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
return false;
}
if (mymailw->verbose>9) {
}
med_int *conn3=new med_int[nbtria3*3];
- ret=MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo,
- pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD);
+ ret=MEDmeshElementConnectivityRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,pfltab);
+ //MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo,pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD);
if (ret < 0){
cerr<<"Problem reading MED_TRIA3\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
//return false;
}
med_int *famtria3skin=new med_int[nbtria3];
- ret=MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3);
+ ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,famtria3skin);
+ //MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3);
if (ret < 0){
cerr<<"Problem reading families of MED_TRIA3\n";
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
return false;
}
if (mymailw->verbose>9) {
//if (mymailw->verbose>6) ok=mymailw->list_keys_mesh_wrap();
- ret = MEDfermer(fid);
+ ret = MEDfileClose(fid);
if (ret < 0){
cerr<<"Problem closing "<<nomfilemed.toLatin1().constData()<<"\n";
return false;
QString path,pathini,casename,casenamemed,fileskinmed,
tmp,cmd,format,
test,menu,launchtepal,background,deletegroups,
- version="V1.6";
+ version="V2.0 (MED3)";
char *chelp=NULL,
*ccasename=NULL,
"\n --background="<<background.toLatin1().constData()<<
"\n --deletegroups=\""<<deletegroups.toLatin1().constData()<<"\"\n";
- //med_idt fid=MEDouvrir("/tmp/empty.med",MED_CREATION);
- //med_err ret=MEDfermer(fid);
- //system("sleep 30");
- //return 0; //ok
-
//utile si appel par plugin ghs3dprl sur big meshes et tepal sur plusieurs jours
if (background=="yes"){
pid_t pid = fork();