X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingFieldT.txx;h=7ed719690d9c72521d71186596ae0d92fa6fcb08;hb=04f1c450d57b28c7c473bdc59dc87eeef7393ca5;hp=7c5a2f6ab2fc89f3d99af24762b650c78c6ef0fa;hpb=7de62920cadf9bfcd33addf31d4a8256bffaf1ec;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingFieldT.txx b/src/MEDCoupling/MEDCouplingFieldT.txx index 7c5a2f6ab..7ed719690 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.txx +++ b/src/MEDCoupling/MEDCouplingFieldT.txx @@ -1,4 +1,4 @@ -// Copyright (C) 2016 CEA/DEN, EDF R&D +// Copyright (C) 2016-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -228,7 +228,7 @@ namespace MEDCoupling * \endif */ template - void MEDCouplingFieldT::renumberCells(const int *old2NewBg, bool check) + void MEDCouplingFieldT::renumberCells(const mcIdType *old2NewBg, bool check) { renumberCellsWithoutMesh(old2NewBg,check); MCAuto m(_mesh->deepCopy()); @@ -259,7 +259,7 @@ namespace MEDCoupling * \throw If mesh nature does not allow renumbering (e.g. structured mesh). */ template - void MEDCouplingFieldT::renumberCellsWithoutMesh(const int *old2NewBg, bool check) + void MEDCouplingFieldT::renumberCellsWithoutMesh(const mcIdType *old2NewBg, bool check) { if(!_mesh) throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !"); @@ -368,10 +368,10 @@ namespace MEDCoupling { if(getArray()->isAllocated()) { - int nbOfCompo=getArray()->getNumberOfComponents(); + std::size_t nbOfCompo=getArray()->getNumberOfComponents(); ret << Traits::FieldTypeName << " default array has " << nbOfCompo << " components and " << getArray()->getNumberOfTuples() << " tuples.\n"; ret << Traits::FieldTypeName << " default array has following info on components : "; - for(int i=0;igetInfoOnComponent(i) << "\" "; ret << "\n"; } @@ -397,7 +397,7 @@ namespace MEDCoupling nat=MEDCouplingNatureOfField::GetRepr(_nature); stream << "Nature of field : " << nat << ".\n"; } - catch(INTERP_KERNEL::Exception& e) + catch(INTERP_KERNEL::Exception&) { } const MEDCouplingFieldDiscretization *fd(_type); if(!fd) @@ -474,13 +474,13 @@ namespace MEDCoupling * \sa MEDCoupling::MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *) const, MEDCouplingFieldDouble::buildSubPartRange */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const int *partBg, const int *partEnd) const + typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : Expecting a not NULL spatial discretization !"); - DataArrayInt *arrSelect; + DataArrayIdType *arrSelect; MCAuto m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect); - MCAuto arrSelect2(arrSelect); + MCAuto arrSelect2(arrSelect); MCAuto< typename Traits::FieldType > ret(clone(false));//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) @@ -490,8 +490,8 @@ namespace MEDCoupling timeDiscrSafe()->getArrays(arrays); std::vector::ArrayType *> arrs; std::vector< MCAuto< typename Traits::ArrayType > > arrsSafe; - const int *arrSelBg=arrSelect->begin(); - const int *arrSelEnd=arrSelect->end(); + const mcIdType *arrSelBg=arrSelect->begin(); + const mcIdType *arrSelEnd=arrSelect->end(); for(typename std::vector::ArrayType *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { typename Traits::ArrayType *arr(0); @@ -534,7 +534,7 @@ namespace MEDCoupling * \sa MEDCouplingFieldDouble::buildSubPartRange */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const DataArrayInt *part) const + typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const DataArrayIdType *part) const { if(part==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : not empty array must be passed to this method !"); @@ -548,14 +548,14 @@ namespace MEDCoupling * \sa MEDCouplingFieldDouble::buildSubPart */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPartRange(int begin, int end, int step) const + typename Traits::FieldType *MEDCouplingFieldT::buildSubPartRange(mcIdType begin, mcIdType end, mcIdType step) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !"); - DataArrayInt *arrSelect; - int beginOut,endOut,stepOut; + DataArrayIdType *arrSelect; + mcIdType beginOut,endOut,stepOut; MCAuto m(_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect)); - MCAuto arrSelect2(arrSelect); + MCAuto arrSelect2(arrSelect); MCAuto< typename Traits::FieldType > ret(clone(false));//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) @@ -572,8 +572,8 @@ namespace MEDCoupling { if(arrSelect) { - const int *arrSelBg=arrSelect->begin(); - const int *arrSelEnd=arrSelect->end(); + const mcIdType *arrSelBg=arrSelect->begin(); + const mcIdType *arrSelEnd=arrSelect->end(); arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd); } else @@ -619,19 +619,19 @@ namespace MEDCoupling * @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny. */ template - void MEDCouplingFieldT::getTinySerializationIntInformation(std::vector& tinyInfo) const + void MEDCouplingFieldT::getTinySerializationIntInformation(std::vector& tinyInfo) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !"); tinyInfo.clear(); - tinyInfo.push_back((int)_type->getEnum()); - tinyInfo.push_back((int)timeDiscrSafe()->getEnum()); - tinyInfo.push_back((int)_nature); + tinyInfo.push_back(ToIdType(_type->getEnum())); + tinyInfo.push_back(ToIdType(timeDiscrSafe()->getEnum())); + tinyInfo.push_back(ToIdType(_nature)); timeDiscrSafe()->getTinySerializationIntInformation(tinyInfo); - std::vector tinyInfo2; + std::vector tinyInfo2; _type->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - tinyInfo.push_back((int)tinyInfo2.size()); + tinyInfo.push_back(ToIdType(tinyInfo2.size())); } /*! @@ -660,18 +660,18 @@ namespace MEDCoupling * \sa checkForUnserialization */ template - void MEDCouplingFieldT::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) + void MEDCouplingFieldT::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); dataInt=0; - std::vector tinyInfoITmp(tinyInfoI); - int sz=tinyInfoITmp.back(); + std::vector tinyInfoITmp(tinyInfoI); + mcIdType sz=tinyInfoITmp.back(); tinyInfoITmp.pop_back(); - std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); - std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); + std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); + std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); timeDiscrSafe()->resizeForUnserialization(tinyInfoI2,arrays); - std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); + std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); _type->resizeForUnserialization(tinyInfoITmp3,dataInt); } @@ -681,29 +681,29 @@ namespace MEDCoupling * \sa resizeForUnserialization */ template - void MEDCouplingFieldT::checkForUnserialization(const std::vector& tinyInfoI, const DataArrayInt *dataInt, const std::vector::ArrayType *>& arrays) + void MEDCouplingFieldT::checkForUnserialization(const std::vector& tinyInfoI, const DataArrayIdType *dataInt, const std::vector::ArrayType *>& arrays) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); - std::vector tinyInfoITmp(tinyInfoI); - int sz=tinyInfoITmp.back(); + std::vector tinyInfoITmp(tinyInfoI); + mcIdType sz=tinyInfoITmp.back(); tinyInfoITmp.pop_back(); - std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); - std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); + std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); + std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); timeDiscrSafe()->checkForUnserialization(tinyInfoI2,arrays); - std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); + std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); _type->checkForUnserialization(tinyInfoITmp3,dataInt); } template - void MEDCouplingFieldT::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) + void MEDCouplingFieldT::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !"); - std::vector tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end()); + std::vector tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end()); // std::vector tmp(tinyInfoD); - int sz=(int)tinyInfoD.back();//very bad, lack of time to improve it + mcIdType sz=ToIdType(tinyInfoD.back());//very bad, lack of time to improve it tmp.pop_back(); std::vector tmp1(tmp.begin(),tmp.end()-sz); std::vector tmp2(tmp.end()-sz,tmp.end()); @@ -711,7 +711,7 @@ namespace MEDCoupling timeDiscrSafe()->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS); _nature=(NatureOfField)tinyInfoI[2]; _type->finishUnserialization(tmp2); - int nbOfElemS=(int)tinyInfoS.size(); + std::size_t nbOfElemS=tinyInfoS.size(); _name=tinyInfoS[nbOfElemS-3]; _desc=tinyInfoS[nbOfElemS-2]; setTimeUnit(tinyInfoS[nbOfElemS-1]); @@ -722,7 +722,7 @@ namespace MEDCoupling * The values returned must be consulted only in readonly mode. */ template - void MEDCouplingFieldT::serialize(DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) const + void MEDCouplingFieldT::serialize(DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !");