]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Generalization of entities management. BR_Dev_For_6_3_1 V6_3_0 V6_3_0rc1
authorageay <ageay>
Mon, 23 May 2011 13:36:21 +0000 (13:36 +0000)
committerageay <ageay>
Mon, 23 May 2011 13:36:21 +0000 (13:36 +0000)
src/MEDLoader/MEDFileMeshElt.cxx

index 542b3f792cef542281d59fd88362de127bc83abc..34ac3999184a1ff7ece509a9a4507d22828167f9 100644 (file)
@@ -24,6 +24,8 @@
 #include "InterpKernelAutoPtr.hxx"
 #include "CellModel.hxx"
 
+#include <iostream>
+
 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;