+using namespace MEDCoupling;
+
+MEDFileUMeshPerTypeCommon *MEDFileUMeshPerTypeCommon::New()
+{
+ return new MEDFileUMeshPerTypeCommon;
+}
+
+void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, int 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())
+ {
+ _fam=DataArrayInt::New();
+ _fam->alloc(curNbOfElem,1);
+ if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,_fam->getPointer())!=0)
+ std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0);
+ }
+ }
+ _num=0;
+ if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(!mrs || mrs->isCellNumFieldReading())
+ {
+ _num=DataArrayInt::New();
+ _num->alloc(curNbOfElem,1);
+ if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,_num->getPointer())!=0)
+ _num=0;
+ }
+ }
+ _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 DataArrayInt *)_num);
+ ret.push_back((const DataArrayInt *)_fam);
+ ret.push_back((const DataArrayAsciiChar *)_names);
+ return ret;
+}