+using namespace MEDCoupling;
+
+MEDFileUMeshPerTypeCommon *MEDFileUMeshPerTypeCommon::New()
+{
+ return new MEDFileUMeshPerTypeCommon;
+}
+
+void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt,
+ med_entity_type entity, MEDFileMeshReadSelector *mrs)
+{
+ med_bool changement,transformation;
+ _fam=0;
+ if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(!mrs || mrs->isCellFamilyFieldReading())
+ {
+ MCAuto<DataArrayMedInt> miFam=DataArrayMedInt::New();
+ miFam->alloc(curNbOfElem,1);
+ if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,miFam->getPointer())!=0)
+ std::fill(miFam->getPointer(),miFam->getPointer()+curNbOfElem,0);
+ _fam=FromMedIntArray<mcIdType>( miFam );
+ }
+ }
+ _num=0;
+ if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(!mrs || mrs->isCellNumFieldReading())
+ {
+ MCAuto<DataArrayMedInt> miNum=DataArrayMedInt::New();
+ miNum->alloc(curNbOfElem,1);
+ if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,miNum->getPointer())!=0)
+ miNum=0;
+ _num=FromMedIntArray<mcIdType>(miNum);
+ }
+ }
+ _names=0;
+ if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NAME,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(!mrs || mrs->isCellNameFieldReading())
+ {
+ _names=DataArrayAsciiChar::New();
+ _names->alloc(curNbOfElem+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
+ if(MEDmeshEntityNameRd(fid,mName,dt,it,entity,geoElt,_names->getPointer())!=0)
+ _names=0;
+ else
+ _names->reAlloc(curNbOfElem);//not a bug to avoid the memory corruption due to last \0 at the end
+ }
+ }
+}
+
+std::size_t MEDFileUMeshPerTypeCommon::getHeapMemorySizeWithoutChildren() const
+{
+ return 0;
+}
+
+std::vector<const BigMemoryObject *> MEDFileUMeshPerTypeCommon::getDirectChildrenWithNull() const
+{
+ std::vector<const BigMemoryObject *> ret;
+ ret.push_back((const DataArrayIdType *)_num);
+ ret.push_back((const DataArrayIdType *)_fam);
+ ret.push_back((const DataArrayAsciiChar *)_names);
+ return ret;
+}