From 39f964410466e24ab3eddb03d87047e5546c30a7 Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 23 May 2011 13:36:21 +0000 Subject: [PATCH] Generalization of entities management. --- src/MEDLoader/MEDFileMeshElt.cxx | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index 542b3f792..34ac39991 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -24,6 +24,8 @@ #include "InterpKernelAutoPtr.hxx" #include "CellModel.hxx" +#include + extern med_geometry_type typmai3[32]; using namespace ParaMEDMEM; @@ -38,17 +40,19 @@ MEDFileUMeshPerType *MEDFileUMeshPerType::New(med_idt fid, const char *mName, in bool MEDFileUMeshPerType::isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity) { - static const med_entity_type entities[1]={MED_CELL}; + static const med_entity_type entities[3]={MED_CELL,MED_DESCENDING_FACE,MED_DESCENDING_EDGE}; int nbOfElt=0; - for(int i=0;i<1;i++) + for(int i=0;i<3;i++) { med_bool changement,transformation; - int tmp=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoElt,MED_CONNECTIVITY,MED_NODAL, + int tmp=MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL, &changement,&transformation); if(tmp>nbOfElt) { nbOfElt=tmp; whichEntity=entities[i]; + if(i>0) + std::cerr << "WARNING : MEDFile has been detected to be no compilant with MED 3 : Please change entity in MEDFile for geotype " << geoElt << std::endl; } } return nbOfElt>0; @@ -98,7 +102,7 @@ void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int MEDmeshElementConnectivityRd(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,connTab); if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { - if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_CELL,geoElt,_fam->getPointer())!=0) + if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,_fam->getPointer())!=0) std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0); } else @@ -128,7 +132,7 @@ void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int med_entity_type entity) { med_bool changement,transformation; - med_int curNbOfElem=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYGON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1; + med_int curNbOfElem=MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYGON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1; _conn_index=DataArrayInt::New(); _conn_index->alloc(curNbOfElem+1,1); _conn=DataArrayInt::New(); @@ -149,14 +153,14 @@ void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int *w2=*w2-1+i; } *w2=*w2-1+curNbOfElem; - if(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYGON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) + if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYGON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { - if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_CELL,MED_POLYGON,_fam->getPointer())!=0) + if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,MED_POLYGON,_fam->getPointer())!=0) std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0); } else std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0); - if(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYGON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) + if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYGON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,MED_POLYGON,_num->getPointer())!=0) _num=0; @@ -177,9 +181,9 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int _fam=DataArrayInt::New(); _fam->alloc(curNbOfElem,1); MEDmeshPolyhedronRd(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn); - if(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) + if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYHEDRON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { - if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,_fam->getPointer())!=0) + if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,MED_POLYHEDRON,_fam->getPointer())!=0) std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0); } else @@ -207,7 +211,7 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int } _num=DataArrayInt::New(); _num->alloc(curNbOfElem,1); - if(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) + if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYHEDRON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,MED_POLYHEDRON,_num->getPointer())!=0) _num=0; -- 2.39.2