From: eap Date: Thu, 19 Dec 2019 13:15:30 +0000 (+0300) Subject: LOT7: fix -Wconversion at med_int==int64 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Feap%2FLOT7;p=tools%2Fmedcoupling.git LOT7: fix -Wconversion at med_int==int64 --- diff --git a/MEDCouplingConfig.cmake.in b/MEDCouplingConfig.cmake.in index f691656a1..42f18a4fe 100644 --- a/MEDCouplingConfig.cmake.in +++ b/MEDCouplingConfig.cmake.in @@ -54,6 +54,7 @@ SET(MEDCOUPLING_USE_MPI @MEDCOUPLING_USE_MPI@) SET(MEDCOUPLING_BUILD_DOC @MEDCOUPLING_BUILD_DOC@) SET(MEDCOUPLING_BUILD_TESTS @MEDCOUPLING_BUILD_TESTS@) SET(MEDCOUPLING_BUILD_GUI @MEDCOUPLING_BUILD_GUI@) +SET(MEDCOUPLING_USE_64BIT_IDS @MEDCOUPLING_USE_64BIT_IDS@) # Advanced options diff --git a/src/MEDLoader/MEDFileBasis.hxx b/src/MEDLoader/MEDFileBasis.hxx index 9e1646f1a..22b772f00 100644 --- a/src/MEDLoader/MEDFileBasis.hxx +++ b/src/MEDLoader/MEDFileBasis.hxx @@ -138,14 +138,14 @@ namespace MEDCoupling { DataArrayMedInt* medIntArray = DataArrayMedInt::New(); if ( sizeof( med_int ) == sizeof( INT )) - { - medIntArray->useArray( reinterpret_cast(intVec.data()), /*owner=*/false, DeallocType::CPP_DEALLOC, intVec.size(), /*nbComp=*/1 ); - } + { + medIntArray->useArray( reinterpret_cast(intVec.data()), /*owner=*/false, DeallocType::CPP_DEALLOC, intVec.size(), /*nbComp=*/1 ); + } else - { - medIntArray->alloc( intVec.size(), 1 ); - std::copy( intVec.begin(), intVec.end(), medIntArray->getPointer() ); - } + { + medIntArray->alloc( intVec.size(), 1 ); + std::copy( intVec.begin(), intVec.end(), medIntArray->getPointer() ); + } return medIntArray; } diff --git a/src/MEDLoader/MEDFileEquivalence.cxx b/src/MEDLoader/MEDFileEquivalence.cxx index ef9ab57db..bbc44b6df 100644 --- a/src/MEDLoader/MEDFileEquivalence.cxx +++ b/src/MEDLoader/MEDFileEquivalence.cxx @@ -207,12 +207,12 @@ void MEDFileEquivalencePair::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,&ncor)); if(ncor>0) { - MCAuto da(DataArrayInt::New()); + MCAuto da(DataArrayMedInt::New()); da->alloc(ncor*2); MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,da->getPointer())); da->applyLin(1,-1); da->rearrange(2); - MCAuto node(new MEDFileEquivalenceNode(this,da)); + MCAuto node(new MEDFileEquivalenceNode(this,FromMedIntArray(da))); _node=node; } _cell=MEDFileEquivalenceCell::Load(fid,this); @@ -406,7 +406,7 @@ void MEDFileEquivalences::writeLL(med_idt fid) const int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& meshName) { med_int nequ(MEDnEquivalence(fid,meshName.c_str())); - return nequ; + return FromMedInt(nequ); } MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileMesh *owner) @@ -419,7 +419,7 @@ MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileM { INTERP_KERNEL::AutoPtr equ(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); - int nstep,nocstpncor; + med_int nstep,nocstpncor; MEDFILESAFECALLERRD0(MEDequivalenceInfo,(fid,meshName.c_str(),i+1,equ,desc,&nstep,&nocstpncor)); std::string eqName(MEDLoaderBase::buildStringFromFortran(equ,MED_NAME_SIZE)),eqDescName(MEDLoaderBase::buildStringFromFortran(desc,MED_COMMENT_SIZE)); MCAuto eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName)); @@ -511,7 +511,7 @@ void MEDFileEquivalenceData::writeAdvanced(med_idt fid, med_entity_type medtype, INTERP_KERNEL::AutoPtr name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy()); MEDLoaderBase::safeStrCpy(equName.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy()); - MCAuto da2(da->deepCopy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2); + MCAuto da2(DataArrayMedInt::Copy(da)); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2); MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,ToMedInt(da2->getNumberOfTuples()),da2->begin())); } @@ -726,12 +726,12 @@ void MEDFileEquivalenceCell::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],&ncor)); if(ncor>0) { - MCAuto da(DataArrayInt::New()); + MCAuto da(DataArrayMedInt::New()); da->alloc(ncor*2); MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],da->getPointer())); da->applyLin(1,-1); da->rearrange(2); - MCAuto ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],da)); + MCAuto ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray(da))); _types.push_back(ct); } } diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 5ab6fbf03..61bceea4a 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -256,7 +256,7 @@ MEDFileFields::MEDFileFields() MEDFileFields::MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) try:MEDFileFieldGlobsReal(fid) { - int nbFields(MEDnField(fid)); + med_int nbFields(MEDnField(fid)); _fields.resize(nbFields); med_field_type typcha; for(int i=0;igetMeshWithName(getMeshName()); } // - _field_per_mesh[0]=MEDFileFieldPerMesh::NewOnRead(fid,this,0,meshnumdt,meshnumit,nasc,mm,entities); + _field_per_mesh[0]=MEDFileFieldPerMesh::NewOnRead(fid,this,0,FromMedInt(meshnumdt),FromMedInt(meshnumit),nasc,mm,entities); _nb_of_tuples_to_be_allocated=0; _field_per_mesh[0]->loadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc); } @@ -1711,7 +1711,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i med_int numdt,numit; med_float dt; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt)); - ret->setTime(numdt,numit,dt); + ret->setTime(FromMedInt(numdt),FromMedInt(numit),dt); ret->_csit=1; if(loadAll) ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities); @@ -1786,7 +1786,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i med_int numdt,numit; med_float dt; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt)); - ret->setTime(numdt,numit,dt); + ret->setTime(FromMedInt(numdt),FromMedInt(numit),dt); ret->_csit=1; if(loadAll) ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities); @@ -2000,21 +2000,21 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c { if(checkFieldId) { - int nbFields=MEDnField(fid); + med_int nbFields=MEDnField(fid); if(fieldIdCFormat>=nbFields) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::LocateField2(fileName) : in file \'" << FileNameFromFID(fid) << "\' number of fields is " << nbFields << " ! Trying to request for id " << fieldIdCFormat << " !"; throw INTERP_KERNEL::Exception(oss.str()); } } - int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1)); + med_int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1)); INTERP_KERNEL::AutoPtr comp(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr unit(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr dtunit(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE)); INTERP_KERNEL::AutoPtr nomcha(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr nomMaa(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_bool localMesh; - int nbOfStep; + med_int nbOfStep; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep)); fieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE); dtunitOut=MEDLoaderBase::buildStringFromFortran(dtunit,MED_LNAME_SIZE); @@ -2022,7 +2022,7 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c infos.clear(); infos.resize(ncomp); for(int j=0;j(nbOfStep); } /*! @@ -2033,7 +2033,7 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c */ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName) { - int nbFields=MEDnField(fid); + med_int nbFields=MEDnField(fid); bool found=false; std::vector fns(nbFields); int nbOfStep2(-1); diff --git a/src/MEDLoader/MEDFileFieldGlobs.cxx b/src/MEDLoader/MEDFileFieldGlobs.cxx index 2302cf551..1a8791fc0 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.cxx +++ b/src/MEDLoader/MEDFileFieldGlobs.cxx @@ -45,7 +45,7 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const std::string if(id>=(int)_pfls.size()) _pfls.resize(id+1); MCAuto miPfl=DataArrayMedInt::New(); - int lgth(MEDprofileSizeByName(fid,pflName.c_str())); + med_int lgth(MEDprofileSizeByName(fid,pflName.c_str())); miPfl->setName(pflName); miPfl->alloc(lgth,1); MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),miPfl->getPointer())); @@ -56,7 +56,7 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const std::string void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int i) { INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - int sz; + med_int sz; MEDFILESAFECALLERRD0(MEDprofileInfo,(fid,i+1,pflName,&sz)); std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE); if(i>=(int)_pfls.size()) @@ -155,10 +155,10 @@ void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& re void MEDFileFieldGlobs::loadAllGlobals(med_idt fid, const MEDFileEntities *entities) { - int nProfil=MEDnProfile(fid); + med_int nProfil=MEDnProfile(fid); for(int i=0;i geointerpname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); + MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&dim,&nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); + _dim=FromMedInt(dim); + _nb_gauss_pt=FromMedInt(nb_gauss_pt); _gt=new MEDFileGTKeeperSta((INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype)))); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); _nb_node_per_cell=cm.getNumberOfNodes(); @@ -138,11 +140,13 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent { med_geometry_type geotype; med_geometry_type sectiongeotype; - int nsectionmeshcell; + med_int nsectionmeshcell,dim,nb_gauss_pt; INTERP_KERNEL::AutoPtr locName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr geointerpname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - MEDFILESAFECALLERRD0(MEDlocalizationInfo,(fid,id+1,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype)); + MEDFILESAFECALLERRD0(MEDlocalizationInfo,(fid,id+1,locName,&geotype,&dim,&nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype)); + _dim=FromMedInt(dim); + _nb_gauss_pt=FromMedInt(nb_gauss_pt); _name=locName; std::string sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE)); if(sectionName.empty()) @@ -164,8 +168,9 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent const MEDFileUMesh *section(entities2->getSupMeshWithName(sectionName)); _gt=new MEDFileGTKeeperDyn(um,section,se); { - int dummy; - MEDFILESAFECALLERRD0(MEDmeshGeotypeParameter,(fid,geotype,&dummy,&_nb_node_per_cell)); + med_int dummy, nb_node_per_cell; + MEDFILESAFECALLERRD0(MEDmeshGeotypeParameter,(fid,geotype,&dummy,&nb_node_per_cell)); + _nb_node_per_cell=FromMedInt(nb_node_per_cell); } } _ref_coo.resize(_dim*_nb_node_per_cell); @@ -556,7 +561,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const { med_entity_type mentiCpy(menti); INTERP_KERNEL::AutoPtr locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - int nbi,tmp1; + med_int nbi,tmp1; med_int nbValsInFile(MEDfieldnValueWithProfileByName(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile.c_str(),MED_COMPACT_PFLMODE,&tmp1,locname,&nbi)); if(nbValsInFile==0 && menti==MED_CELL) {// @@ -582,8 +587,8 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const if(!_profile.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : not implemented !"); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - int profilesize,nbi; - int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int profilesize,nbi; + med_int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { @@ -638,18 +643,18 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_i INTERP_KERNEL::AutoPtr locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); std::string fieldName(nasc.getName()),meshName(getMeshName()); - int iteration(getIteration()),order(getOrder()),profilesize,nbi; + med_int iteration(getIteration()),order(getOrder()),profilesize,nbi; TypeOfField type(getType()); med_geometry_type mgeoti; med_entity_type menti; _father->entriesForMEDfile(type,mgeoti,menti); - int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal==0 && type==ON_CELLS) {//eheh maybe there's a surprise :) - int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal1==0) { - int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal2!=0) zeNVal=zeNVal2; } @@ -1818,7 +1823,7 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField INTERP_KERNEL::AutoPtr locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); med_geometry_type mgeoti; med_entity_type menti(ConvertIntoMEDFileType(type,geoType,mgeoti)); - int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName)); + med_int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName)); _field_pm_pt_pd.resize(nbProfiles); for(int i=0;i=nbProfiles2?MED_DESCENDING_FACE:MED_DESCENDING_EDGE;//not enough words to describe the beauty @@ -1881,7 +1886,7 @@ MEDFileFieldPerMeshPerTypeDyn::MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFil _se.takeRef(se); INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName)); + med_int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,_se->getDynGT(),pflName,locName)); _field_pm_pt_pd.resize(nbProfiles); for(int i=0;i iter0(MFFPMIter::NewCell(entities)); for(iter0->begin();!iter0->finished();iter0->next()) { - int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); - int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); if(nbProfile>0 || nbProfile2>0) { @@ -3142,7 +3147,7 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith } if(MFFPMIter::IsPresenceOfNode(entities)) { - int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName)); + med_int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName)); if(nbProfile>0) { const PartDefinition *pd(0); @@ -3157,7 +3162,7 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith std::vector dynGT(entities->getDynGTAvail()); for(std::vector::const_iterator it=dynGT.begin();it!=dynGT.end();it++) { - int nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,*it,pflName,locName)); + med_int nbPfl(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_STRUCT_ELEMENT,*it,pflName,locName)); if(nbPfl>0) { _field_pm_pt.push_back(MEDFileFieldPerMeshPerTypeDyn::NewOnRead(fid,this,entities,*it,nasc)); @@ -3170,9 +3175,9 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith iter0=MFFPMIter::NewCell(entities); for(iter0->begin();!iter0->finished();iter0->next()) { - int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + med_int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); std::string name0(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); - int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + med_int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); std::string name1(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); if(nbProfile>0 || nbProfile2>0) { diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 7a1cc9bad..3f19a60c9 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -494,24 +494,24 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR { case MED_FLOAT64: { - _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } case MED_INT32: { - _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } case MED_FLOAT32: { - _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } case MED_INT: { if(sizeof(med_int)==sizeof(int)) { - _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } } diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index 1dd96e42c..af5ea9d17 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -263,13 +263,13 @@ MEDFileJointOneStep* MEDFileJointOneStep::New(med_idt fid, const std::string& mN MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, const std::string& jointName, int num) { - int order, iteration, ncorrespondence; + med_int order, iteration, ncorrespondence; MEDFILESAFECALLERRD0(MEDsubdomainComputingStepInfo,(fid, mName.c_str(), jointName.c_str(), num, &order, &iteration, &ncorrespondence)); - MEDFileJointOneStep::setOrder(order); - MEDFileJointOneStep::setIteration(iteration); + MEDFileJointOneStep::setOrder(FromMedInt(order)); + MEDFileJointOneStep::setIteration(FromMedInt(iteration)); for ( int cur_it = 1; cur_it <= ncorrespondence; ++cur_it ) { - int num_entity; + med_int num_entity; med_entity_type loc_ent_type, rem_ent_type; med_geometry_type loc_geo_type, rem_geo_type; MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceSizeInfo,(fid, mName.c_str(), jointName.c_str(), order, iteration, cur_it, @@ -482,14 +482,14 @@ MEDFileJoint::MEDFileJoint(med_idt fid, const std::string& mName, int curJoint) INTERP_KERNEL::AutoPtr joint_name=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr desc_name=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); INTERP_KERNEL::AutoPtr rem_mesh_name=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - int domain_number=0, nstep=0, nocstpncorrespondence=0; + med_int domain_number=0, nstep=0, nocstpncorrespondence=0; MEDFILESAFECALLERRD0(MEDsubdomainJointInfo,(fid,mName.c_str(), curJoint, joint_name, desc_name, &domain_number,rem_mesh_name, &nstep, &nocstpncorrespondence)); setLocalMeshName(mName); setRemoteMeshName(MEDLoaderBase::buildStringFromFortran(rem_mesh_name,MED_NAME_SIZE)); setDescription(MEDLoaderBase::buildStringFromFortran(desc_name,MED_COMMENT_SIZE)); setJointName(MEDLoaderBase::buildStringFromFortran(joint_name,MED_NAME_SIZE)); - setDomainNumber(domain_number); + setDomainNumber(FromMedInt(domain_number)); for(int cur_step=1; cur_step <= nstep; ++cur_step) { MEDFileJointOneStep *cor=MEDFileJointOneStep::New(fid, mName.c_str(), getJointName(), cur_step); @@ -760,7 +760,7 @@ MEDFileJoints::MEDFileJoints() MEDFileJoints::MEDFileJoints(med_idt fid, const std::string& meshName) { - int num_joint=MEDnSubdomainJoint(fid, meshName.c_str() ); + med_int num_joint=MEDnSubdomainJoint(fid, meshName.c_str() ); for(int i = 1; i <= num_joint; i++) _joints.push_back(MEDFileJoint::New(fid,meshName,i)); } diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index f57a5c2c7..b45e6f7e8 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -2965,7 +2965,7 @@ void MEDFileUMesh::loadLL(med_idt fid, const std::string& mName, int dt, int it, loaderl2.loadAll(fid,mid,mName,dt,it,mrs); dispatchLoadedPart(fid,loaderl2,mName,mrs); // Structure element part... - int nModels(-1); + med_int nModels(-1); { med_bool chgt=MED_FALSE,trsf=MED_FALSE; nModels=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,MED_GEO_ALL,MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf); diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 7ccfa9793..c58d94320 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -47,17 +47,19 @@ int MEDFileMeshL2::ZE_SEP2_FOR_FAMILY_KILLERS=4; std::vector MeshCls::getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const { med_mesh_type type_maillage; - med_int spaceDim; + med_int spaceDim, meshDim, nbSteps; med_sorting_type stype; med_axis_type axistype; - int naxis(MEDmeshnAxis(fid,getID())); + med_int naxis(MEDmeshnAxis(fid,getID())); INTERP_KERNEL::AutoPtr nameTmp(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr univTmp(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE)); - if(MEDmeshInfo(fid,getID(),nameTmp,&spaceDim,&Mdim,&type_maillage,description.getPointer(),dtunit.getPointer(), - &stype,&nstep,&axistype,axisname,axisunit)!=0) + if(MEDmeshInfo(fid,getID(),nameTmp,&spaceDim,&meshDim,&type_maillage,description.getPointer(),dtunit.getPointer(), + &stype,&nbSteps,&axistype,axisname,axisunit)!=0) throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !"); + Mdim=FromMedInt(meshDim); + nstep=FromMedInt(nbSteps); MEDmeshUniversalNameRd(fid,nameTmp,univName.getPointer());// do not protect MEDFILESAFECALLERRD0 call : Thanks to fra.med. axType=MEDFileMeshL2::TraduceAxisType(axistype); switch(type_maillage) @@ -127,9 +129,9 @@ std::vector StructMeshCls::getAxisInfoOnMesh(med_idt fid, const std INTERP_KERNEL::AutoPtr msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr zeDescription(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); med_axis_type medAxType; - int nAxis(MEDsupportMeshnAxis(fid,getID())); + med_int nAxis(MEDsupportMeshnAxis(fid,getID())); INTERP_KERNEL::AutoPtr axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]); - int spaceDim(0),meshDim(0); + med_int spaceDim(0),meshDim(0); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,getID(),msn,&spaceDim,&meshDim,zeDescription,&medAxType,axisName,axisUnit)); std::string descriptionCpp(MEDLoaderBase::buildStringFromFortran(zeDescription,MED_COMMENT_SIZE)); description.set(descriptionCpp.c_str()); @@ -179,11 +181,11 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( int ret=-1; med_sorting_type stype; std::vector ms; - int nstep; + med_int nstep; med_axis_type axistype; for(int i=0;i axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit)); dtunit1=MEDLoaderBase::buildStringFromFortran(dtunit,sizeof(dtunit)); @@ -197,10 +199,10 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( } if(found==0) {//last chance ! Is it a support mesh ? - int nbSM(MEDnSupportMesh(fid)); + med_int nbSM(MEDnSupportMesh(fid)); for(int i=0;i axisname(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)),axisunit(MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE)); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,maillage_description,&axistype,axisname,axisunit)); std::string cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa))); @@ -249,7 +251,7 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( med_int numdt,numit; med_float dtt; MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,mName.c_str(),1,&numdt,&numit,&dtt)); - dt=numdt; it=numit; + dt=FromMedInt(numdt); it=FromMedInt(numit); return new MeshCls(ret); } case 2: @@ -286,7 +288,7 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName med_int numfam; med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector< std::pair > > > crudeFams(nfam); - for(med_int i=0;i& inf { int spaceDim((int)infosOnComp.size()); med_bool changement,transformation; - int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + med_int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); _coords=DataArrayDouble::New(); _coords->alloc(nCoords,spaceDim); double *coordsPtr(_coords->getPointer()); @@ -649,7 +651,7 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax) { med_bool changement,transformation; - int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + med_int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); _coords=DataArrayDouble::New(); mcIdType nbNodesToLoad(nMax-nMin); _coords->alloc(nbNodesToLoad,spaceDim); @@ -802,7 +804,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const { med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf)); + med_int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf)); MCAuto da=DataArrayDouble::New(); da->alloc(nbOfElt,1); da->setInfoOnComponent(0,infosOnComp[i]); @@ -851,7 +853,7 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const MCAuto stGrid=FromMedIntArray(miStGrid); _clmesh->setNodeGridStructure(stGrid->begin(),stGrid->end()); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf)); + med_int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf)); MCAuto da=DataArrayDouble::New(); da->alloc(nbNodes,infosOnComp.size()); da->setInfoOnComponents(infosOnComp); diff --git a/src/MEDLoader/MEDFileMeshSupport.cxx b/src/MEDLoader/MEDFileMeshSupport.cxx index 0ac762bbf..4be2a9116 100644 --- a/src/MEDLoader/MEDFileMeshSupport.cxx +++ b/src/MEDLoader/MEDFileMeshSupport.cxx @@ -45,16 +45,16 @@ MEDFileMeshSupports *MEDFileMeshSupports::New() MEDFileMeshSupports::MEDFileMeshSupports(med_idt fid) { - int nbSM(MEDnSupportMesh(fid)); + med_int nbSM(MEDnSupportMesh(fid)); _supports.resize(nbSM); for(int i=0;i msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr description(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); med_axis_type axType; - int nAxis(MEDsupportMeshnAxis(fid,i+1)); + med_int nAxis(MEDsupportMeshnAxis(fid,i+1)); INTERP_KERNEL::AutoPtr axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]); - int spaceDim(0),meshDim(0); + med_int spaceDim(0),meshDim(0); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,msn,&spaceDim,&meshDim,description,&axType,axisName,axisUnit)); std::string name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE)); _supports[i]=MEDFileUMesh::New(fid,name); diff --git a/src/MEDLoader/MEDFileParameter.cxx b/src/MEDLoader/MEDFileParameter.cxx index e978b51af..c08481883 100644 --- a/src/MEDLoader/MEDFileParameter.cxx +++ b/src/MEDLoader/MEDFileParameter.cxx @@ -21,6 +21,7 @@ #include "MEDFileParameter.hxx" #include "MEDFileSafeCaller.txx" #include "MEDLoaderBase.hxx" +#include "MEDFileBasis.hxx" #include "InterpKernelAutoPtr.hxx" @@ -110,12 +111,12 @@ void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& std::ostringstream oss; oss << "MEDFileParameterDouble1TS::finishLoading : no specified time step (" << dt << "," << it << ") ! Time steps available : "; for(int i=0;i(locDt); _order=FromMedInt(locIt); _time=tim; MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast(&_arr))); return ; } @@ -136,10 +137,10 @@ void MEDFileParameterDouble1TSWTI::readValue(med_idt fid, const std::string& nam void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int timeStepId) { - int locDt,locIt; + med_int locDt,locIt; double dt; MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt)); - _iteration=locDt; _order=locIt; _time=dt; + _iteration=FromMedInt(locDt); _order=FromMedInt(locIt); _time=dt; MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast(&_arr))); } @@ -212,7 +213,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - int nbPar=MEDnParameter(fid); + med_int nbPar=MEDnParameter(fid); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); @@ -220,7 +221,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName med_parameter_type paramType; for(int i=0;i(nbOfSteps)); return ; } else @@ -244,7 +245,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - int nbPar=MEDnParameter(fid); + med_int nbPar=MEDnParameter(fid); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); @@ -252,7 +253,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName med_parameter_type paramType; for(int i=0;i descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); INTERP_KERNEL::AutoPtr unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE); med_parameter_type paramType; - int nbOfSteps; + med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps)); std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); if(paramType==MED_FLOAT64) @@ -407,7 +408,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS& MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid) { - int nbPar(MEDnParameter(fid)); + med_int nbPar(MEDnParameter(fid)); if(nbPar<1) { std::ostringstream oss; oss << "MEDFileParameterMultiTS : no parameter in file \"" << FileNameFromFID(fid) << "\" !" ; @@ -417,18 +418,18 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid) INTERP_KERNEL::AutoPtr descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); INTERP_KERNEL::AutoPtr unitName(MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE)); med_parameter_type paramType; - int nbOfSteps; + med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps)); std::string paramNameCpp(MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE)); _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE); _name=paramNameCpp; _desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE); - finishLoading(fid,paramType,nbOfSteps); + finishLoading(fid,paramType,FromMedInt(nbOfSteps)); } MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& paramName) { - int nbPar(MEDnParameter(fid)); + med_int nbPar(MEDnParameter(fid)); std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : "; INTERP_KERNEL::AutoPtr pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); @@ -436,7 +437,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& med_parameter_type paramType; for(int i=0;i(nbOfSteps)); return ; } else @@ -469,13 +470,13 @@ void MEDFileParameterMultiTS::finishLoading(med_idt fid, med_parameter_type typ, _param_per_ts.resize(nbOfSteps); for(int i=0;i(dt),FromMedInt(it),tim); _param_per_ts[i]->readValue(fid,_name.c_str()); break; /*case MED_INT32; @@ -724,7 +725,7 @@ MEDFileParameters *MEDFileParameters::New(med_idt fid) MEDFileParameters::MEDFileParameters(med_idt fid) { - int nbPar=MEDnParameter(fid); + med_int nbPar=MEDnParameter(fid); _params.resize(nbPar); INTERP_KERNEL::AutoPtr pName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); @@ -732,7 +733,7 @@ MEDFileParameters::MEDFileParameters(med_idt fid) med_parameter_type paramType; for(int i=0;i constattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_attribute_type constatttype; - int nbCompo; + med_int nbCompo; med_entity_type met; med_int miPflSz; MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&miPflSz)); @@ -71,7 +71,7 @@ MEDFileSEConstAtt::MEDFileSEConstAtt(med_idt fid, MEDFileStructureElement *fathe _tof=MEDFileMesh::ConvertFromMEDFileEntity(met); // _val=MEDFileStructureElement::BuildFrom(constatttype); - nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,nbCompo); + nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,FromMedInt(nbCompo)); mcIdType pflSz = miPflSz; if(pflSz==0 && getProfile().empty()) { @@ -142,7 +142,9 @@ MEDFileSEVarAtt::MEDFileSEVarAtt(med_idt fid, MEDFileStructureElement *father, i med_attribute_type varatttype; { //int pflSz; - MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&_nb_compo)); + med_int nbComp; + MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&nbComp)); + _nb_compo=FromMedInt(nbComp); } setName(MEDLoaderBase::buildStringFromFortran(varattname,MED_NAME_SIZE)); _gen=MEDFileStructureElement::BuildFrom(varatttype); @@ -175,11 +177,14 @@ MEDFileStructureElement::MEDFileStructureElement(med_idt fid, int idSE, const ME INTERP_KERNEL::AutoPtr modelName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),supportMeshName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_geometry_type sgeoType; med_entity_type entiyType; - int nConsAttr(0),nVarAttr(0); + med_int nConsAttr(0),nVarAttr(0); { med_bool anyPfl; - int nnode(0),ncell(0); - MEDFILESAFECALLERRD0(MEDstructElementInfo,(fid,idSE+1,modelName,&_id_type,&_dim,supportMeshName,&entiyType,&nnode,&ncell,&sgeoType,&nConsAttr,&anyPfl,&nVarAttr)); + med_int nnode(0),ncell(0),dim(0); + med_geometry_type idType; + MEDFILESAFECALLERRD0(MEDstructElementInfo,(fid,idSE+1,modelName,&idType,&dim,supportMeshName,&entiyType,&nnode,&ncell,&sgeoType,&nConsAttr,&anyPfl,&nVarAttr)); + _id_type=(int)idType; + _dim=FromMedInt(dim); } _name=MEDLoaderBase::buildStringFromFortran(modelName,MED_NAME_SIZE); _sup_mesh_name=MEDLoaderBase::buildStringFromFortran(supportMeshName,MED_NAME_SIZE); @@ -328,7 +333,7 @@ void MEDFileStructureElements::writeLL(med_idt fid) const MEDFileStructureElements::MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms) { - int nbSE(MEDnStructElement(fid)); + med_int nbSE(MEDnStructElement(fid)); _elems.resize(nbSE); for(int i=0;i tmp(new char[lgth+1]); diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 7cd676ceb..07d3e9393 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -163,12 +163,12 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st med_mesh_type type_maillage; med_int Sdim,Mdim; std::string trueMeshName; - med_int meshId=getIdFromMeshName(fid,meshName,trueMeshName); + int meshId=FromMedInt(getIdFromMeshName(fid,meshName,trueMeshName)); INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); med_sorting_type sortingType; med_int nstep; med_axis_type axisType; - int naxis(MEDmeshnAxis(fid,meshId)); + med_int naxis(MEDmeshnAxis(fid,meshId)); INTERP_KERNEL::AutoPtr axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); @@ -185,9 +185,9 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st { med_geometry_type curMedType=typmai[i]; med_bool changement,transformation; - int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); - int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation - int curNbOfElem; + med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + med_int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation + med_int curNbOfElem; med_entity_type whichEntity; MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity); if(curNbOfElem>0) @@ -208,7 +208,7 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st return ret; } -med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) +int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) { if(meshName.empty()) { @@ -231,7 +231,7 @@ med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, throw INTERP_KERNEL::Exception(os2.str().c_str()); } trueMeshName=meshName; - return ToMedInt( iter-meshes.begin()+1 ); + return (int)( iter-meshes.begin()+1 ); } std::vector MEDLoaderNS::getMeshNamesFid(med_idt fid) @@ -248,10 +248,10 @@ std::vector MEDLoaderNS::getMeshNamesFid(med_idt fid) std::vector ret(n); for(int i=0;i axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); - int nstep; + med_int nstep; MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit)); std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)); ret[i]=cur; @@ -262,7 +262,7 @@ std::vector MEDLoaderNS::getMeshNamesFid(med_idt fid) /*! * This methods allows to merger all entities and to considerate only cell types. */ -void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity) +void MEDLoaderNS::dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity) { if(nbOfElemCell>=nbOfElemFace) { @@ -340,9 +340,9 @@ void MEDCoupling::MEDFileVersion(int& major, int& minor, int& release) med_err ret(MEDlibraryNumVersion(&majj,&minn,&rell)); if(ret!=0) throw INTERP_KERNEL::Exception("MEDFileVersion : fail to call MEDlibraryNumVersion ! It looks very bad !"); - major=majj; - minor=minn; - release=rell; + major=FromMedInt(majj); + minor=FromMedInt(minn); + release=FromMedInt(rell); } /*! @@ -378,7 +378,7 @@ void MEDCoupling::SetTooLongStrPolicy(int val) * - the space dimension * - the number of nodes */ -std::vector< std::vector< std::pair > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes) +std::vector< std::vector< std::pair > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes) { MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); std::set poss; @@ -386,15 +386,17 @@ std::vector< std::vector< std::pair > > M char maillage_description[MED_COMMENT_SIZE+1]; med_mesh_type type_maillage; std::string trueMeshName; - med_int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName); + int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName); INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); med_sorting_type sortingType; - med_int nstep; + med_int nstep, mDim, sDim; med_axis_type axisType; - int naxis(MEDmeshnAxis(fid,meshId)); + med_int naxis(MEDmeshnAxis(fid,meshId)); INTERP_KERNEL::AutoPtr axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); - MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); + MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&sDim,&mDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); + meshDim=FromMedInt(mDim); + spaceDim=FromMedInt(sDim); if(type_maillage!=MED_UNSTRUCTURED_MESH) { std::ostringstream oss; oss << "GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName; @@ -414,7 +416,7 @@ std::vector< std::vector< std::pair > > M for(int i=0;i0) { INTERP_KERNEL::NormalizedCellType typp=typmai2[i]; @@ -431,7 +433,7 @@ std::vector< std::vector< std::pair > > M { ret[maxLev-dims[i]].push_back(geoTypes[i]); } - numberOfNodes=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation); + numberOfNodes=ToIdType(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); return ret; } @@ -518,7 +520,7 @@ std::vector MEDCoupling::GetMeshFamiliesNames(const std::string& fi med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -541,7 +543,7 @@ std::vector MEDCoupling::GetMeshFamiliesNamesOnGroup(const std::str med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -569,7 +571,7 @@ std::vector MEDCoupling::GetMeshGroupsNamesOnFamily(const std::stri bool found=false; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -604,7 +606,7 @@ std::vector MEDCoupling::GetMeshGroupsNames(const std::string& file med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -746,7 +748,7 @@ std::vector MEDCoupling::GetCellFieldNamesOnMesh(const std::string& MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); - int profilesize,nbi; + med_int profilesize,nbi; if(curMeshName==meshName) { bool found=false; @@ -796,7 +798,7 @@ std::vector MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); if(nbPdt>0) { - int profilesize,nbi; + med_int profilesize,nbi; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt)); med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE, pflname,&profilesize,locname,&nbi)); @@ -946,7 +948,7 @@ std::vector< std::pair > MEDCoupling::GetCellFieldIterations(const std: { for(int k=0;k > MEDCoupling::GetNodeFieldIterations(const std: { for(int k=0;k #include @@ -48,7 +49,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void MEDFileVersion(int& major, int& minor, int& release); MEDLOADER_EXPORT void CheckFileForRead(const std::string& fileName); MEDLOADER_EXPORT std::vector GetMeshNames(const std::string& fileName); - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes); + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes); MEDLOADER_EXPORT std::vector< std::pair > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName); MEDLOADER_EXPORT std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName); MEDLOADER_EXPORT std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName); diff --git a/src/MEDLoader/MEDLoaderNS.hxx b/src/MEDLoader/MEDLoaderNS.hxx index 4726172f8..b637292b6 100644 --- a/src/MEDLoader/MEDLoaderNS.hxx +++ b/src/MEDLoader/MEDLoaderNS.hxx @@ -34,10 +34,10 @@ namespace MEDCoupling namespace MEDLoaderNS { int readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector& possibilities); - void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity); + void dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity); template void writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const typename MEDCoupling::Traits::FieldType *f, bool writeFromScratch); - med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName); + int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName); std::vector getMeshNamesFid(med_idt fid); } diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 261efa111..457fefbda 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -507,7 +507,8 @@ namespace MEDCoupling PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName) { - int meshDim,spaceDim,numberOfNodes; + int meshDim,spaceDim; + mcIdType numberOfNodes; std::vector< std::vector< std::pair > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes); PyObject *ret=PyTuple_New(4); PyObject *elt0=PyList_New(res.size()); @@ -529,7 +530,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,0,elt0); PyTuple_SetItem(ret,1,SWIG_From_int(meshDim)); PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim)); - PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes)); + PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes)); return ret; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx index 7b240cf35..d462f9fd3 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx @@ -704,7 +704,7 @@ std::vector MEDPARTITIONER::GetInfosOfField(const char *fileName, c { for (int j=0; j ret; - int meshDim, spaceDim, numberOfNodes; + int meshDim, spaceDim; + mcIdType numberOfNodes; std::vector< std::vector< std::pair > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes)); std::vector types; std::vector distrib;