ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${XDR_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
IF(MEDCOUPLING_ENABLE_PYTHON)
ADD_SUBDIRECTORY(Swig)
ENDIF(MEDCOUPLING_ENABLE_PYTHON)
conn->checkAllocated();
if(conn->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : excepted to be single compo !");
- int nbCells(conn->getNumberOfTuples());
MCAuto<DataArrayDouble> connOut(coo->selectByTupleIdSafe(conn->begin(),conn->end()));
MCAuto<MEDCouplingUMesh> mcOut(MEDCouplingUMesh::Build0DMeshFromCoords(connOut));
mcOut->setName(BuildNewMeshName(mesh->getName(),MED_BALL_STR));
//
MCAuto<MEDCouplingFieldDouble> dir(geoMesh->buildDirectionVectorField());
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- int nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
- int nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size());
+ mcIdType nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
{
const int TAB[3]={2,0,1};
std::vector<std::size_t> v(TAB,TAB+3);
for(int l=0;l<nbg;l++)
{
MCAuto<DataArrayDouble> p2(p->deepCopy());
- for(int k=0;k<nbCompo;k++)
+ for(std::size_t k=0;k<nbCompo;k++)
p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
arrs[j*nbg+l]=p2;
}
{
MCAuto<DataArrayDouble> ptsForLoc;
MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
- int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size());
+ mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
MCConstAuto<DataArrayDouble> zeThickness;
if(!pfl.empty())
{
MCAuto<MEDCouplingFieldDouble> ortho(geoMesh->buildOrthogonalField());
orthoArr.takeRef(ortho->getArray());
}
- int nbCompo(orthoArr->getNumberOfComponents());
+ mcIdType nbCompo(ToIdType(orthoArr->getNumberOfComponents()));
MCAuto<DataArrayDouble> secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo));
secPts->rearrange(nbCompo);
std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
- for(int j=0;j<nbCells;j++)
+ for(mcIdType j=0;j<nbCells;j++)
{
double thck(zeThickness->getIJ(j,0)),eccentricity(zeThickness->getIJ(j,1));
MCAuto<DataArrayDouble> fact(DataArrayDouble::New()),fact2(DataArrayDouble::New()); fact->alloc(1,nbCompo); fact2->alloc(1,nbCompo);
static const char MSG1[]="BuildMeshPipeSEG3 : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !";
MCAuto<DataArrayDouble> ptsForLoc;
MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(INTERP_KERNEL::NORM_SEG3,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
- int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size());
+ mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
MCConstAuto<DataArrayDouble> zeAngle,zeScale;
if(!pfl.empty())
{
dir=geoMesh2->buildDirectionVectorField();
}
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- int nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
{
const int TAB[3]={2,0,1};
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
double AX1[3]; AX1[2]=0.;
std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
- for(int j=0;j<nbCells;j++)
+ for(mcIdType j=0;j<nbCells;j++)
{
constexpr int DIM=3;
MCAuto<DataArrayDouble> p(secPts->deepCopy());
MCAuto<DataArrayDouble> p3(p->deepCopy());
DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,zeAngle->getIJ(j,l),nbSecPts,p3->begin(),p3->getPointer());
MCAuto<DataArrayDouble> p2(p3->deepCopy());
- for(int k=0;k<nbCompo;k++)
+ for(std::size_t k=0;k<nbCompo;k++)
p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
arrs[j*nbg+l]=p2;
}
int MEDFileEquivalences::size() const
{
- return _equ.size();
+ return (int)_equ.size();
}
std::vector<std::string> MEDFileEquivalences::getEquivalenceNames() const
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<DataArrayInt> da2(da->deepCopy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2);
- MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,da2->getNumberOfTuples(),da2->begin()));
+ MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,ToMedInt(da2->getNumberOfTuples()),da2->begin()));
}
std::size_t MEDFileEquivalenceCellType::getHeapMemorySizeWithoutChildren() const
return ;
MEDFileEquivalences::CheckDataArray(da);
MEDFileMesh *mm(getMesh());
- int totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
+ mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
//
MCAuto<DataArrayInt> tmp(da->deepCopy()); tmp->rearrange(1);
int maxv,minv;
std::vector<std::size_t> compS(1,0);
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gts.begin();it!=gts.end();it++)
{
- endId=startId+mm->getNumberOfCellsWithType(*it);
+ endId=startId+(int)mm->getNumberOfCellsWithType(*it);
MCAuto<DataArrayInt> da0(da->keepSelectedComponents(compS));
MCAuto<DataArrayIdType> ids(da0->findIdsInRange(startId,endId));
MCAuto<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
int MEDFileFields::getNumberOfFields() const
{
- return _fields.size();
+ return (int)_fields.size();
}
std::vector<std::string> MEDFileFields::getFieldsNames() const
void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step)
{
static const char msg[]="MEDFileFields::destroyFieldsAtPos2";
- int nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
+ mcIdType nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
std::vector<bool> b(_fields.size(),true);
int k=bg;
for(int i=0;i<nbOfEntriesToKill;i++,k+=step)
{
public:
PFLData():_add_pts_in_pfl(0) { }
- PFLData(const MCAuto<DataArrayIdType>& mat, const MCAuto<DataArrayIdType>& pfl, int nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { }
+ PFLData(const MCAuto<DataArrayIdType>& mat, const MCAuto<DataArrayIdType>& pfl, mcIdType nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { }
std::string getPflName() const { if(_pfl.isNull()) { return std::string(); } else { return _pfl->getName(); } }
- int getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; }
+ mcIdType getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; }
MCAuto<DataArrayIdType> getProfile() const { return _pfl; }
MCAuto<DataArrayIdType> getMatrix() const { return _matrix; }
private:
MCAuto<DataArrayIdType> _matrix;
MCAuto<DataArrayIdType> _pfl;
- int _add_pts_in_pfl;
+ mcIdType _add_pts_in_pfl;
};
class MEDFileFieldLin2QuadVisitor : public MEDFileFieldVisitor
//
void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd);
private:
- void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes);
+ void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes);
private:
const MEDFileUMesh *_lin;
const MEDFileUMesh *_quad;
updateData(pmtdToModify,pdata.getNbOfAddPtsInPfl());
}
-void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes)
+void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes)
{
pmtd->incrementNbOfVals(deltaNbNodes);
}
{
std::string tmp(fieldName);
std::vector<std::string> poss;
- for(std::size_t i=0;i<_fields.size();i++)
+ for(unsigned int i=0;i<_fields.size();i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *f(_fields[i]);
if(f)
const DataArray *arr(getUndergroundDataArray());
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !");
- int nbOfCompo=arr->getNumberOfComponents();
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfCompo);
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
{
ret[i]=deepCopy();
std::vector<std::size_t> v(1,i);
MEDFileFieldPerMeshPerTypePerDisc *disc(fpm->getLeafGivenTypeAndLocId(ct,0));
if(disc->getType()!=tof)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : error !");
- int s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples());
+ mcIdType s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples());
DataArray *arr(getUndergroundDataArray());
- int nt2(arr->getNumberOfTuples()),delta((e-s)-nt);
+ mcIdType nt2(arr->getNumberOfTuples()),delta((e-s)-nt);
if(delta<0)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : internal error !");
MCAuto<DataArray> arr0(arr->selectByTupleIdSafeSlice(0,s,1)),arr1(arr->selectByTupleIdSafeSlice(s,e,1)),arr2(arr->selectByTupleIdSafeSlice(e,nt2,1));
if((*it)->getMeshName()==tmp)
return i;
}
- int sz=_field_per_mesh.size();
+ std::size_t sz=_field_per_mesh.size();
_field_per_mesh.resize(sz+1);
_field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh);
- return sz;
+ return (int)sz;
}
bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
newArr->alloc(newLgth,getNumberOfComponents());
if(oldArr)
newArr->copyStringInfoFrom(*oldArr);
- int pos=0;
+ mcIdType pos=0;
for(std::vector< std::pair<mcIdType,mcIdType> >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++)
{
if((*it).second<(*it).first)
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !");
std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
- int nbOfTypes=geoTypes.size();
+ std::size_t nbOfTypes=geoTypes.size();
std::vector<mcIdType> code(3*nbOfTypes);
MCAuto<DataArrayIdType> arr1=DataArrayIdType::New();
arr1->alloc(nbOfTypes,1);
mcIdType *arrPtr=arr1->getPointer();
std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
- for(int i=0;i<nbOfTypes;i++,it++)
- arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
+ for(std::size_t i=0;i<nbOfTypes;i++,it++)
+ arrPtr[i]=ToIdType(std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it)));
MCAuto<DataArrayIdType> arr2=arr1->checkAndPreparePermutation();
const mcIdType *arrPtr2=arr2->getConstPointer();
int i=0;
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs);
- int nbOfRet=ret0.size();
+ std::size_t nbOfRet=ret0.size();
std::vector< std::vector<DataArrayDouble *> > ret(nbOfRet);
- for(int i=0;i<nbOfRet;i++)
+ for(std::size_t i=0;i<nbOfRet;i++)
{
const std::vector< std::pair<mcIdType,mcIdType> >& p=ret0[i];
- int nbOfRet1=p.size();
+ std::size_t nbOfRet1=p.size();
ret[i].resize(nbOfRet1);
- for(int j=0;j<nbOfRet1;j++)
+ for(std::size_t j=0;j<nbOfRet1;j++)
{
DataArrayDouble *tmp=_arr->selectByTupleIdSafeSlice(p[j].first,p[j].second,1);
ret[i][j]=tmp;
const DataArrayDouble *arr(_arr);
if(arr)
{
- MCAuto<DataArrayIdType> arr2(arr->convertToIntArr());
+ MCAuto<DataArrayInt> arr2(arr->convertToIntArr());
ret->setArray(arr2);
}
return ret.retn();
MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
std::string oldPflName=disc->getProfile();
std::vector<std::string> vv=getPflsReallyUsedMulti();
- int nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
+ std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
{
disc->setProfile(newPflName);
MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
std::string oldLocName=disc->getLocalization();
std::vector<std::string> vv=getLocsReallyUsedMulti();
- int nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
+ std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1))
{
disc->setLocalization(newLocName);
void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const
{
- int nbComp(getNumberOfComponents());
+ std::size_t nbComp(getNumberOfComponents());
INTERP_KERNEL::AutoPtr<char> comp(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE));
INTERP_KERNEL::AutoPtr<char> unit(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE));
- for(int i=0;i<nbComp;i++)
+ for(std::size_t i=0;i<nbComp;i++)
{
std::string info=getInfo()[i];
std::string c,u;
}
if(getName().empty())
throw INTERP_KERNEL::Exception("MEDFileField1TS::write : MED file does not accept field with empty name !");
- MEDFILESAFECALLERWR0(MEDfieldCr,(fid,getName().c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,getName().c_str(),getMEDFileFieldType(),ToMedInt(nbComp),comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
writeGlobals(fid,*this);
contentNotNullBase()->writeLL(fid,*this,*contentNotNullBase());
}
void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) const
{
- int nbOfPfls=_pfls.size();
- for(int i=0;i<nbOfPfls;i++)
+ std::size_t nbOfPfls=_pfls.size();
+ for(std::size_t i=0;i<nbOfPfls;i++)
{
MCAuto<DataArrayMedInt> cpy=DataArrayMedInt::Copy((const DataArrayIdType*)_pfls[i]);
cpy->applyLin(1,1,0);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy());
- MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,_pfls[i]->getNumberOfTuples(),cpy->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,ToMedInt(_pfls[i]->getNumberOfTuples()),cpy->getConstPointer()));
}
//
- int nbOfLocs=_locs.size();
- for(int i=0;i<nbOfLocs;i++)
+ std::size_t nbOfLocs=_locs.size();
+ for(std::size_t i=0;i<nbOfLocs;i++)
_locs[i]->writeLL(fid);
}
}
else
{
- int id=std::distance(pfls.begin(),it2);
+ std::size_t id=std::distance(pfls.begin(),it2);
if(!(*it)->isEqual(*_pfls[id]))
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !";
}
else
{
- int id=std::distance(locs.begin(),it2);
+ std::size_t id=std::distance(locs.begin(),it2);
if(!(*it)->isEqual(*_locs[id],eps))
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !";
void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real)
{
std::vector<std::string> profiles=real.getPflsReallyUsed();
- int sz=profiles.size();
+ std::size_t sz=profiles.size();
_pfls.resize(sz);
- for(int i=0;i<sz;i++)
+ for(unsigned int i=0;i<sz;i++)
loadProfileInFile(fid,i,profiles[i].c_str());
//
std::vector<std::string> locs=real.getLocsReallyUsed();
sz=locs.size();
_locs.resize(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
_locs[i]=MEDFileFieldLoc::New(fid,locs[i].c_str());
}
oss << "\"" << (*it)->getName() << "\", ";
throw INTERP_KERNEL::Exception(oss.str());
}
- return std::distance(_locs.begin(),it);
+ return (int)std::distance(_locs.begin(),it);
}
int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const
oss << "\"" << (*it)->getName() << "\", ";
throw INTERP_KERNEL::Exception(oss.str());
}
- return std::distance(_pfls.begin(),it);
+ return (int)std::distance(_pfls.begin(),it);
}
/*!
std::vector<std::string> MEDFileFieldGlobs::getPfls() const
{
- int sz=_pfls.size();
+ std::size_t sz=_pfls.size();
std::vector<std::string> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
ret[i]=_pfls[i]->getName();
return ret;
}
std::vector<std::string> MEDFileFieldGlobs::getLocs() const
{
- int sz=_locs.size();
+ std::size_t sz=_locs.size();
std::vector<std::string> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
ret[i]=_locs[i]->getName();
return ret;
}
std::vector< std::vector<int> > MEDFileFieldGlobs::whichAreEqualProfiles() const
{
- std::map<int,std::vector<int> > m;
+ std::map<mcIdType,std::vector<int> > m;
int i=0;
for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
}
}
std::vector< std::vector<int> > ret;
- for(std::map<int,std::vector<int> >::const_iterator it2=m.begin();it2!=m.end();it2++)
+ for(std::map<mcIdType,std::vector<int> >::const_iterator it2=m.begin();it2!=m.end();it2++)
{
if((*it2).second.size()>1)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType()));
_dim=cm.getDimension();
_nb_node_per_cell=cm.getNumberOfNodes();
- _nb_gauss_pt=_w.size();
+ _nb_gauss_pt=(int)_w.size();
}
oss << "\n - Dimension : " << _dim << "\n - Number of gauss points : ";
oss << _nb_gauss_pt << "\n - Number of nodes in cell : " << _nb_node_per_cell;
oss << "\n - Ref coords are : ";
- int sz=_ref_coo.size();
+ std::size_t sz=_ref_coo.size();
if(sz%_dim==0)
{
- int nbOfTuples=sz/_dim;
- for(int i=0;i<nbOfTuples;i++)
+ std::size_t nbOfTuples=sz/_dim;
+ for(std::size_t i=0;i<nbOfTuples;i++)
{
oss << "(";
for(int j=0;j<_dim;j++)
sz=_gs_coo.size();
if(sz%_dim==0)
{
- int nbOfTuples=sz/_dim;
- for(int i=0;i<nbOfTuples;i++)
+ std::size_t nbOfTuples=sz/_dim;
+ for(std::size_t i=0;i<nbOfTuples;i++)
{
oss << "(";
for(int j=0;j<_dim;j++)
case ON_GAUSS_PT:
{
const MEDCouplingFieldDiscretization *disc(field->getDiscretization());
- const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(_loc_id));
+ const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(FromIdType<int>(_loc_id)));
const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !");
const DataArrayIdType *dai(disc2->getArrayOfDiscIds());
MCAuto<DataArrayIdType> dai2(disc2->getOffsetArr(field->getMesh()));
const mcIdType *dai2Ptr(dai2->getConstPointer());
- int nbi(gsLoc.getWeights().size());
+ mcIdType nbi(ToIdType(gsLoc.getWeights().size()));
MCAuto<DataArrayIdType> da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1));
MCAuto<DataArrayIdType> da3(da2->findIdsEqual(_loc_id));
const mcIdType *da3Ptr(da3->getConstPointer());
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
const DataArrayIdType *da1=disc2->getArrayOfDiscIds();
- const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id);
+ const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(FromIdType<int>(_loc_id));
MCAuto<DataArrayIdType> da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end());
MCAuto<DataArrayIdType> da3=da2->findIdsEqual(_loc_id);
MCAuto<DataArrayIdType> da4=idsInPfl->selectByTupleId(da3->begin(),da3->end());
start=_end;
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd)
{
return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,profileIt,pd);
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId)
{
return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,locId,std::string());
}
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : not implemented !");
INTERP_KERNEL::AutoPtr<char> 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,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(pd));
if(spd)
{
mcIdType start,stop,step;
spd->getSlice(start,stop,step);
- int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile"));
+ mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile"));
med_filter filter=MED_FILTER_INIT;
MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/start+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(start+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter));
MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,startFeedingPtr));
MEDfilterClose(&filter);
{
dpd->checkConsistencyLight();
MCAuto<DataArrayIdType> myIds(dpd->toDAI());
- int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray());
+ mcIdType a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray());
myIds=myIds->deepCopy();// WARNING deep copy here because _pd is modified by applyLin !!!
myIds->applyLin(1,-a);
- int nbOfEltsToLoad(b-a+1);
+ mcIdType nbOfEltsToLoad(b-a+1);
med_filter filter=MED_FILTER_INIT;
{//TODO : manage int32 !
MCAuto<DataArrayDouble> tmp(DataArrayDouble::New());
tmp->alloc(nbOfEltsToLoad,nbOfCompo);
MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/a+1,/*stride*/1,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(a+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter));
MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast<unsigned char *>(tmp->getPointer())));
MCAuto<DataArrayDouble> feeder(DataArrayDouble::New());
med_geometry_type mgeoti;
med_entity_type menti;
_father->entriesForMEDfile(type,mgeoti,menti);
- int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,ToMedInt(_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,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,ToMedInt(_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,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
+ int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi));
if(zeNVal2!=0)
zeNVal=zeNVal2;
}
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << "] !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbOfCompo(arr->getNumberOfComponents());
+ int nbOfCompo((int)arr->getNumberOfComponents());
DataArrayDouble *arrD(dynamic_cast<DataArrayDouble *>(arr));
if(arrD)
{
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
- DataArrayIdType *arrI(dynamic_cast<DataArrayIdType *>(arr));
+ DataArrayInt32 *arrI(dynamic_cast<DataArrayInt32 *>(arr));
if(arrI)
{
- mcIdType *startFeeding(arrI->getPointer()+_start*nbOfCompo);
+ int *startFeeding(arrI->getPointer()+_start*nbOfCompo);
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
if(!arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !");
const DataArrayDouble *arrD(dynamic_cast<const DataArrayDouble *>(arr));
- const DataArrayIdType *arrI(dynamic_cast<const DataArrayIdType *>(arr));
+ const DataArrayInt32 *arrI(dynamic_cast<const DataArrayInt32 *>(arr));
const DataArrayFloat *arrF(dynamic_cast<const DataArrayFloat *>(arr));
const unsigned char *locToWrite=0;
if(arrD)
else
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 FLOAT32 and INT32 !");
MEDFILESAFECALLERWR0(MEDfieldValueWithProfileWr,(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti,
- MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval,
+ MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,ToMedInt(_nval),
locToWrite));
}
*/
mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(mcIdType offset, const std::vector<mcIdType>& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const
{
- _loc_id=offset;
+ _loc_id=FromIdType<int>(offset);
std::ostringstream oss;
std::size_t nbOfType=codeOfMesh.size()/3;
int found=-1;
return _end-_start;
}
-int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, int locId)
+int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, mcIdType locId)
{
switch(type)
{
case ON_GAUSS_NE:
return -1;
case ON_GAUSS_PT:
- return locId;
+ return FromIdType<int>(locId);
default:
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::ConvertType : not managed type of field !");
}
int id=0;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++)
{
- int startOfEltIdOfChunk=(*it)->_start;
+ mcIdType startOfEltIdOfChunk=(*it)->_start;
MCAuto<DataArrayIdType> newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
MCAuto<DataArrayIdType> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
MCAuto<DataArrayIdType> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
//
MCAuto<DataArrayDouble> arrPart=arr->subArray(offset,offset+szTuples);
arrPart->renumberInPlace(renumTupleIds->begin());
- arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1);
+ arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,ToIdType(arrPart->getNumberOfComponents()),1);
bool ret=false;
const mcIdType *idIt=diffVals->begin();
std::list<const MEDFileFieldPerMeshPerTypePerDisc *> li(entriesOnSameDisc.begin(),entriesOnSameDisc.end());
* \return a newly allocated chunk
*/
MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt,
- bool isPfl, int nbi, mcIdType offset,
+ bool isPfl, mcIdType nbi, mcIdType offset,
std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
MEDFileFieldGlobsReal& glob,
bool ¬InExisting)
if(type!=ON_GAUSS_PT)
{
int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
- int sz=_field_pm_pt_pd.size();
+ std::size_t sz=_field_pm_pt_pd.size();
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(std::size_t j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
else
{
std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells);
- mcIdType sz2=ret2.size();
+ std::size_t sz2=ret2.size();
std::vector<mcIdType> ret3(sz2);
mcIdType k=0;
- for(mcIdType i=0;i<sz2;i++)
+ for(std::size_t i=0;i<sz2;i++)
{
- mcIdType sz=_field_pm_pt_pd.size();
+ mcIdType sz=ToIdType(_field_pm_pt_pd.size());
mcIdType locIdToFind=ret2[i];
bool found=false;
for(mcIdType j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
- _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType<int>(locIdToFind));
ret3[k++]=j;
found=true;
}
if(!found)
{
_field_pm_pt_pd.resize(sz+1);
- _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType<int>(locIdToFind));
ret3[k++]=sz;
}
}
if(type!=ON_GAUSS_PT)
{
int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
- mcIdType sz=_field_pm_pt_pd.size();
+ std::size_t sz=_field_pm_pt_pd.size();
bool found=false;
- for(mcIdType j=0;j<sz && !found;j++)
+ for(std::size_t j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
else
{
std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,subCells);
- mcIdType sz2=ret2.size();
+ std::size_t sz2=ret2.size();
std::vector<mcIdType> ret3(sz2);
mcIdType k=0;
- for(mcIdType i=0;i<sz2;i++)
+ for(std::size_t i=0;i<sz2;i++)
{
- mcIdType sz=_field_pm_pt_pd.size();
+ mcIdType sz=ToIdType(_field_pm_pt_pd.size());
mcIdType locIdToFind=ret2[i];
bool found=false;
for(mcIdType j=0;j<sz && !found;j++)
void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const
{
- mcIdType sz=_field_pm_pt_pd.size();
+ std::size_t sz=_field_pm_pt_pd.size();
dads.resize(sz); types.resize(sz); pfls.resize(sz); locs.resize(sz);
- for(mcIdType i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
_field_pm_pt_pd[i]->getCoarseData(types[i],dads[i],pfls[i],locs[i]);
}
(*it1)->changeLocsRefsNamesGen(mapOfModif);
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId)
{
if(_field_pm_pt_pd.empty())
{
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !";
throw INTERP_KERNEL::Exception(oss.str());
}
- if(locId>=0 && locId<(int)_field_pm_pt_pd.size())
+ if(locId>=0 && locId<ToIdType(_field_pm_pt_pd.size()))
return _field_pm_pt_pd[locId];
std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId;
oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
return static_cast<MEDFileFieldPerMeshPerTypePerDisc*>(0);
}
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId) const
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) const
{
if(_field_pm_pt_pd.empty())
{
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !";
throw INTERP_KERNEL::Exception(oss.str());
}
- if(locId>=0 && locId<(int)_field_pm_pt_pd.size())
+ if(locId>=0 && locId<ToIdType(_field_pm_pt_pd.size()))
return _field_pm_pt_pd[locId];
std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no such locId available (" << locId;
oss2 << ") for geometric type \"" << getGeoTypeRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std::vector<mcIdType>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
std::size_t nbOfTypes=code.size()/3;
- int offset=0;
+ mcIdType offset=0;
for(std::size_t i=0;i<nbOfTypes;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
DataArrayIdType *pfl=0;
if(code[3*i+2]!=-1)
pfl=idsPerType[code[3*i+2]];
- mcIdType nbOfTupes2=code2.size()/3;
- mcIdType found=0;
+ std::size_t nbOfTupes2=code2.size()/3;
+ std::size_t found=0;
for(;found<nbOfTupes2;found++)
if(code[3*i]==code2[3*found])
break;
void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const
{
- mcIdType nbOfTypes=_field_pm_pt.size();
- for(mcIdType i=0;i<nbOfTypes;i++)
+ std::size_t nbOfTypes=_field_pm_pt.size();
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
_field_pm_pt[i]->copyOptionsFrom(*this);
_field_pm_pt[i]->writeLL(fid,nasc);
std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> > & locs) const
{
- int sz=_field_pm_pt.size();
+ std::size_t sz=_field_pm_pt.size();
std::vector< std::vector<std::pair<mcIdType,mcIdType> > > ret(sz);
types.resize(sz); typesF.resize(sz); pfls.resize(sz); locs.resize(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
types[i]=_field_pm_pt[i]->getGeoType();
_field_pm_pt[i]->fillFieldSplitedByType(ret[i],typesF[i],pfls[i],locs[i]);
void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<const DataArrayIdType *>& pfls, const std::vector<int>& locs, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& notNullPfls)
{
int notNullPflsSz=0;
- int nbOfArrs=geoTypes.size();
- for(int i=0;i<nbOfArrs;i++)
+ std::size_t nbOfArrs=geoTypes.size();
+ for(std::size_t i=0;i<nbOfArrs;i++)
if(pfls[i])
notNullPflsSz++;
std::set<INTERP_KERNEL::NormalizedCellType> geoTypes3(geoTypes.begin(),geoTypes.end());
- int nbOfDiffGeoTypes=geoTypes3.size();
+ std::size_t nbOfDiffGeoTypes=geoTypes3.size();
code.resize(3*nbOfDiffGeoTypes);
notNullPfls.resize(notNullPflsSz);
notNullPflsSz=0;
- int j=0;
- for(int i=0;i<nbOfDiffGeoTypes;i++)
+ std::size_t j=0;
+ for(std::size_t i=0;i<nbOfDiffGeoTypes;i++)
{
- int startZone=j;
+ std::size_t startZone=j;
INTERP_KERNEL::NormalizedCellType refType=geoTypes[j];
std::vector<const DataArrayIdType *> notNullTmp;
if(pfls[j])
*/
mcIdType MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs)
{
- int sz=dads.size();
- int ret=0;
- for(int i=0;i<sz;i++)
+ std::size_t sz=dads.size();
+ mcIdType ret=0;
+ for(std::size_t i=0;i<sz;i++)
{
if(locs[i]==-1)
{
DataArrayDouble *arr(dynamic_cast<DataArrayDouble *>(arr0));//tony
if(!arr0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values is double ! Not managed for the moment !");
- int sz=0;
+ mcIdType sz=0;
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !");
for(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >::const_iterator it=entries.begin();it!=entries.end();it++)
////////////////////
MCAuto<DataArrayIdType> explicitIdsOldInMesh=DataArrayIdType::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after
mcIdType *workI2=explicitIdsOldInMesh->getPointer();
- int sz1=0,sz2=0,sid=1;
+ mcIdType sz1=0,sz2=0,sid=1;
std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptML=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKept);
// std::vector<int> tupleIdOfStartOfNewChuncksV(entriesKeptML.size());
for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++)
{
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
- int nb=code[1];
+ mcIdType nb=code[1];
if(code[2]==-1)
{
if(nb!=mesh->getNumberOfNodes())
{
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
- int nb=code[1];
+ mcIdType nb=code[1];
if(code[2]==-1)
{
if(nb!=mesh->getNumberOfNodes())
}
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId)
{
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
throw INTERP_KERNEL::Exception(oss.str());
}
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const
{
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles !");
std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it1(pms.begin());
std::vector< std::pair<int,int> >::const_iterator it2(filteredDTS.begin());
- int zeStart(start),nval(0);
+ mcIdType zeStart(start),nval(0);
for(;it1!=pms.end();it1++,it2++)
{
if((*it1).first!=(*it2).first)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles 2 !");
- int s1((*it1).second->getStart()),e1((*it1).second->getEnd());
+ mcIdType s1((*it1).second->getStart()),e1((*it1).second->getEnd());
extractInfo.push_back(std::pair<int, std::pair<int,int> >((*it1).first,std::pair<int,int>(s1,e1)));
start+=e1-s1;
nval+=((*it1).second)->getNumberOfVals();
int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type)
{
int i=0;
- int pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type));
+ std::size_t pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type));
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it2=_field_pm_pt.begin();
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
{
return i;
else
{
- int pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType));
+ std::size_t pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType));
if(pos>pos2)
it2=it+1;
}
}
- int ret=std::distance(_field_pm_pt.begin(),it2);
+ std::size_t ret=std::distance(_field_pm_pt.begin(),it2);
_field_pm_pt.insert(it2,MEDFileFieldPerMeshPerType::New(this,type));
- return ret;
+ return (int)ret;
}
/*!
da->setName("");
if(type==ON_GAUSS_PT)
{
- int offset=0;
- int nbOfArrs=dads.size();
- for(int i=0;i<nbOfArrs;i++)
+ mcIdType offset=0;
+ std::size_t nbOfArrs=dads.size();
+ for(std::size_t i=0;i<nbOfArrs;i++)
{
std::vector<std::pair<mcIdType,mcIdType> > dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
const std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes2(1,INTERP_KERNEL::NORM_ERROR);
- int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
+ mcIdType nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
MCAuto<DataArrayIdType> di=DataArrayIdType::New();
di->alloc(nbOfElems,1);
di->iota(offset);
class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
{
public:
- static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd);
- static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId);
+ static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
+ static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId);
static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
void setProfile(const std::string& newPflName);
std::string getLocalization() const;
void setLocalization(const std::string& newLocName);
- int getLocId() const { return _loc_id; }
- void setLocId(int newId) const { _loc_id=newId; }
+ mcIdType getLocId() const { return _loc_id; }
+ void setLocId(mcIdType newId) const { _loc_id=newId; }
void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; }
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
mcIdType fillEltIdsFromCode(mcIdType offset, const std::vector<mcIdType>& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const;
mcIdType fillTupleIds(mcIdType *ptToFill) const;
- static int ConvertType(TypeOfField type, int locId);
+ static int ConvertType(TypeOfField type, mcIdType locId);
static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
static bool RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
const DataArrayIdType *explicitIdsInMesh, const std::vector<mcIdType>& newCode,
MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result);
static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt,
- bool isPfl, int nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
+ bool isPfl, mcIdType nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
MEDFileFieldGlobsReal& glob, bool ¬InExisting);
static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(mcIdType &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { }
std::string _profile;
std::string _localization;
//! only on assignment -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
- mutable int _loc_id;
+ mutable mcIdType _loc_id;
mutable mcIdType _profile_it;
MCAuto<PartDefinition> _pd;
public:
- mutable int _tmp_work1;
+ mutable mcIdType _tmp_work1;
};
class MEDFileFieldVisitor;
std::vector<std::string> getLocsReallyUsedMulti() const;
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
- MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId);
- const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const;
- int getNumberOfLoc() const { return _field_pm_pt_pd.size(); }
+ MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId);
+ const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId) const;
+ int getNumberOfLoc() const { return (int)_field_pm_pt_pd.size(); }
int locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const;
void fillValues(mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
- MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId);
- const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const;
+ MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId);
+ const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const;
static MCAuto<MEDFileFieldPerMesh> Aggregate(mcIdType &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
private:
int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const
{
static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
- int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ mcIdType nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
ret->setInfo(_infos);
- int sz=(int)_time_steps.size();
- int j=bg;
+ std::size_t sz=_time_steps.size();
+ std::size_t j=bg;
for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
{
if(j>=0 && j<sz)
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
- mcIdType id=0;
+ int id=0;
MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
- mcIdType id=0;
+ int id=0;
MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
checkThatNbOfCompoOfTSMatchThis();
std::vector<std::string> infos(getInfo());
- int nbComp=infos.size();
+ std::size_t nbComp=infos.size();
INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
- for(int i=0;i<nbComp;i++)
+ for(unsigned int i=0;i<nbComp;i++)
{
std::string info=infos[i];
std::string c,u;
}
if(_name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
- MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
- int nbOfTS=_time_steps.size();
- for(int i=0;i<nbOfTS;i++)
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),ToMedInt(nbComp),comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
+ std::size_t nbOfTS=_time_steps.size();
+ for(std::size_t i=0;i<nbOfTS;i++)
_time_steps[i]->writeLL(fid,opts,*this);
}
int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
{
- return _time_steps.size();
+ return (int)_time_steps.size();
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step)
{
static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2";
- int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ mcIdType nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
if(nbOfEntriesToKill==0)
return ;
std::size_t sz=_time_steps.size();
std::vector<bool> b(sz,true);
int j=bg;
- for(int i=0;i<nbOfEntriesToKill;i++,j+=step)
+ for(mcIdType i=0;i<nbOfEntriesToKill;i++,j+=step)
b[j]=false;
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
for(std::size_t i=0;i<sz;i++)
std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
{
- int lgth=_time_steps.size();
+ std::size_t lgth=_time_steps.size();
std::vector< std::pair<int,int> > ret(lgth);
- for(int i=0;i<lgth;i++)
+ for(std::size_t i=0;i<lgth;i++)
_time_steps[i]->fillIteration(ret[i]);
return ret;
}
std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const
{
- int lgth=_time_steps.size();
+ std::size_t lgth=_time_steps.size();
std::vector< std::vector<TypeOfField> > ret(lgth);
- for(int i=0;i<lgth;i++)
+ for(std::size_t i=0;i<lgth;i++)
_time_steps[i]->fillTypesOfFieldAvailable(ret[i]);
return ret;
}
if(sz!=_geo_types.size())
return false;
mcIdType strt(0);
- for(std::size_t i=0;i<sz;i++)
+ for(unsigned int i=0;i<sz;i++)
{
const MEDFileField1TSStructItem2& p(fst[i]);
if(!p.isFastlyEqual(strt,_geo_types[i],getPflNameOfId(i).c_str()))
isWithoutCopy=false;
std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
std::vector< const DataArrayIdType *> ret(sz);
- int start(0);
+ mcIdType start(0);
for(std::size_t i=0;i<sz;i++)
{
const DataArrayIdType *pfl(_pfls[i]);
- int lgth(_nb_entities[i]);
+ mcIdType lgth(_nb_entities[i]);
if(pfl)
{
MCAuto<DataArrayIdType> tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1));
isWithoutCopy=false;
std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
std::vector< const DataArrayIdType *> ret(sz);
- int start(0);
+ mcIdType start(0);
for(std::size_t i=0;i<sz;i++)
{
const DataArrayIdType *pfl(_pfls[i]);
- int lgth(_nb_entities[i]);
+ mcIdType lgth(_nb_entities[i]);
if(pfl)
{
MCAuto<DataArrayIdType> tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1));
std::vector< const DataArray *> arr(s.size());
std::vector< MCAuto<DataArray> > arrSafe(s.size());
int iii(0);
- int nc(vals->getNumberOfComponents());
+ mcIdType nc(ToIdType(vals->getNumberOfComponents()));
std::vector<std::string> compInfo(vals->getInfoOnComponents());
for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it=_geo_types.begin();it!=_geo_types.end();it++,iii++)
{
*/
void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
- int nbOfVertices(verticesToAdd->getNumberOfTuples());
+ mcIdType nbOfVertices(verticesToAdd->getNumberOfTuples());
std::size_t sz(_pfls.size());
_pfls.resize(sz+1);
_geo_types.resize(sz+1,INTERP_KERNEL::NORM_POINT1);
if(!tmp)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : the coordinates are null !");
MCAuto<DataArrayDouble> a(const_cast<DataArrayDouble *>(tmp)); tmp->incrRef();
- int szBCE(0),szD(0),szF(0);
+ mcIdType szBCE(0),szD(0),szF(0);
bool isPolyh(false);
int iii(0);
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
else
{ cur2=dynamic_cast<MEDCoupling1GTUMesh *>(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; }
//
- int curNbCells(cur->getNumberOfCells());
+ mcIdType curNbCells(cur->getNumberOfCells());
szBCE+=curNbCells;
if((*it)->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
szD+=cur->getNodalConnectivity()->getNumberOfTuples()+curNbCells;
MCAuto<DataArrayIdType> e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(0),*fPtr(0);
if(isPolyh)
{ e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); }
- int k(0);
+ mcIdType k(0);
iii=0;
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
{
else
{ cur2=dynamic_cast<MEDCoupling1GTUMesh *>(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; }
//
- int curNbCells(cur->getNumberOfCells());
+ mcIdType curNbCells(cur->getNumberOfCells());
int gt((int)cur->getCellModelEnum());
if(gt<0 || gt>=PARAMEDMEM_2_VTKTYPE_LGTH)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : invalid geometric type !");
{
if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA27)
{
- int nnpc(scur->getNumberOfNodesPerCell());
- for(int i=0;i<curNbCells;i++,connPtr+=nnpc)
+ mcIdType nnpc(scur->getNumberOfNodesPerCell());
+ for(mcIdType i=0;i<curNbCells;i++,connPtr+=nnpc)
{
*dPtr++=nnpc;
dPtr=std::copy(connPtr,connPtr+nnpc,dPtr);
}
else
{
- for(int i=0;i<curNbCells;i++,connPtr+=27)
+ for(mcIdType i=0;i<curNbCells;i++,connPtr+=27)
{
*dPtr++=27;
for(int j=0;j<27;j++,dPtr++)
{ std::fill(ePtr,ePtr+curNbCells,-1); ePtr+=curNbCells; }
else
{
- int kk(0);
+ mcIdType kk(0);
for(int i=0;i<curNbCells;i++,connIPtr++)
{
- int nbFace(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1);
+ mcIdType nbFace(ToIdType(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1));
*fPtr++=nbFace;
const mcIdType *work(connPtr+connIPtr[0]);
for(int j=0;j<nbFace;j++)
{
const mcIdType *work2=std::find(work,connPtr+connIPtr[1],-1);
- *fPtr++=std::distance(work,work2);
+ *fPtr++=ToIdType(std::distance(work,work2));
fPtr=std::copy(work,work2,fPtr);
work=work2+1;
}
coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end()));
return ;
}
- int sz(coords->getNumberOfTuples());
+ mcIdType sz(coords->getNumberOfTuples());
std::vector<bool> b(sz,false);
const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
while(work!=endW)
{
- int nb(*work++);
- for(int i=0;i<nb && work!=endW;i++,work++)
+ mcIdType nb(*work++);
+ for(mcIdType i=0;i<nb && work!=endW;i++,work++)
{
if(*work>=0 && *work<sz)
b[*work]=true;
work=polyhedNodalConnVTK->begin(); endW=polyhedNodalConnVTK->end();
while(work!=endW)
{
- int nb(*work++);
- for(int i=0;i<nb && work!=endW;i++)
+ mcIdType nb(*work++);
+ for(mcIdType i=0;i<nb && work!=endW;i++)
{
- int nb2(*work++);
- for(int j=0;j<nb2 && work!=endW;j++,work++)
+ mcIdType nb2(*work++);
+ for(mcIdType j=0;j<nb2 && work!=endW;j++,work++)
{
if(*work>=0 && *work<sz)
b[*work]=true;
}
}
}
- int szExp(std::count(b.begin(),b.end(),true));
- if(szExp!=nr->getNumberOfTuples())
+ std::size_t szExp(std::count(b.begin(),b.end(),true));
+ if(ToIdType(szExp)!=nr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !");
// Go renumbering !
MCAuto<DataArrayIdType> o2n(DataArrayIdType::New()); o2n->alloc(sz,1);
mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples());
while(work2!=endW2)
{
- int nb(*work2++);
- for(int i=0;i<nb && work2!=endW2;i++,work2++)
+ mcIdType nb(*work2++);
+ for(mcIdType i=0;i<nb && work2!=endW2;i++,work2++)
*work2=permPtr[o2nPtrc[*work2]];
}
if(polyhedNodalConnVTK)
work2=polyhedNodalConnVTK->getPointer(); endW2=polyhedNodalConnVTK->getPointer()+polyhedNodalConnVTK->getNumberOfTuples();
while(work2!=endW2)
{
- int nb(*work2++);
- for(int i=0;i<nb && work2!=endW2;i++)
+ mcIdType nb(*work2++);
+ for(mcIdType i=0;i<nb && work2!=endW2;i++)
{
- int nb2(*work2++);
- for(int j=0;j<nb2 && work2!=endW2;j++,work2++)
+ mcIdType nb2(*work2++);
+ for(mcIdType j=0;j<nb2 && work2!=endW2;j++,work2++)
*work2=permPtr[o2nPtrc[*work2]];
}
}
void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
- int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
+ mcIdType nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
MEDMeshMultiLev::appendVertices(verticesToAdd,nr);
MCAuto<MEDCoupling1SGTUMesh> elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1));
elt->allocateCells(nbOfCells);
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
mcIdType pt(verticesToAdd->getIJ(i,0));
elt->insertNextCell(&pt,&pt+1);
return ;
std::vector<mcIdType> ngs(getNodeGridStructure());
MCAuto<DataArrayIdType> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
- MCAuto<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size())));
+ MCAuto<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension((int)ngs.size())));
m->setNodalConnectivity(conn);
const DataArrayIdType *pfl(_pfls[0]);
if(pfl)
else
{
MCAuto<MEDCouplingCMesh> m(MEDCouplingCMesh::New());
- for(std::size_t i=0;i<ngs.size();i++)
+ for(unsigned int i=0;i<ngs.size();i++)
m->setCoordsAt(i,_coords[i]);
MCAuto<MEDCoupling1SGTUMesh> m2(m->build1SGTUnstructured());
MCAuto<MEDCoupling1GTUMesh> m3=dynamic_cast<MEDCoupling1GTUMesh *>(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
if(_loc.empty())
{
if(getPflName().empty())
- return (_start_end.second-_start_end.first)/_nb_of_entity;
+ return (int)((_start_end.second-_start_end.first)/_nb_of_entity);
else
- return (_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples();
+ return (int)((_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples());
}
else
{
int MEDFileFastCellSupportComparator::getNumberOfTS() const
{
- return _f1ts_cmps.size();
+ return (int)_f1ts_cmps.size();
}
std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileFastCellSupportComparator::getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
std::ostringstream oss; oss << "MEDFileJointCorrespondence : error on attempt to write in file : \"" << fileName << "\"";
- MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
+ MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
if (( !_is_nodal ) &&
( _loc_geo_type == INTERP_KERNEL::NORM_ERROR ||
order, iteration,
MED_NODE, MED_NONE,
MED_NODE, MED_NONE,
- _correspondence->getNbOfElems()/2,
+ ToMedInt(_correspondence->getNbOfElems()/2),
ToMedIntArray(_correspondence)->getConstPointer()));
}
else
order, iteration,
MED_CELL, typmai3[ _loc_geo_type ],
MED_CELL, typmai3[ _rem_geo_type ],
- _correspondence->getNbOfElems()/2,
+ ToMedInt(_correspondence->getNbOfElems()/2),
ToMedIntArray(_correspondence)->getConstPointer()));
}
}
med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
std::ostringstream oss; oss << "MEDFileJointOneStep : error on attempt to write in file : \"" << fileName << "\"";
- MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
+ MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
if ( _correspondences.empty() )
throw INTERP_KERNEL::Exception("MEDFileJointOneStep::write : no correspondences defined !");
writeLL(fid, localMeshName, jointName);
int MEDFileJointOneStep::getNumberOfCorrespondences() const
{
- return _correspondences.size();
+ return (int)_correspondences.size();
}
/** Return a borrowed reference (caller is not responsible) */
int MEDFileJoint::getNumberOfSteps() const
{
- return _joint.size();
+ return (int)_joint.size();
}
/** Return a borrowed reference (caller is not responsible) */
int MEDFileJoints::getNumberOfJoints() const
{
- return _joints.size();
+ return (int)_joints.size();
}
/** Return a borrowed reference (caller is not responsible) */
removeFamiliesReferedByNoGroups();
//
std::vector<int> levels(getNonEmptyLevelsExt());
- std::set<int> idsRefed;
+ std::set<mcIdType> idsRefed;
for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
idsRefed.insert((*it).second);
if(!fams)
continue;
std::vector<bool> v(fams->getNumberOfTuples(),false);
- for(std::set<int>::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++)
+ for(std::set<mcIdType>::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++)
fams->switchOnTupleEqualTo(*pt,v);
MCAuto<DataArrayIdType> unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v));
if(!unfetchedIds->empty())
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<mcIdType> allFamIds;
mcIdType maxId=getMaxFamilyId()+1;
- std::map<mcIdType,std::vector<mcIdType> > famIdsToRenum;
+ std::map<int,std::vector<mcIdType> > famIdsToRenum;
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
const DataArrayIdType *fam=getFamilyFieldAtLevel(*it);
if(famIdsToRenum.empty())
return true;
MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
- for(std::map<mcIdType,std::vector<mcIdType> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
+ for(std::map<int,std::vector<mcIdType> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
{
DataArrayIdType *fam=const_cast<DataArrayIdType *>(getFamilyFieldAtLevel((*it2).first));
mcIdType *famIdsToChange=fam->getPointer();
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different each other !");
if(grpsName.find(std::string(""))!=grpsName.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different empty string !");
- int sz=getSizeAtLevel(meshDimRelToMaxExt);
+ mcIdType sz=getSizeAtLevel(meshDimRelToMaxExt);
MCAuto<DataArrayIdType> fam;
std::vector< std::vector<mcIdType> > fidsOfGroups;
if(!renum)
//attempt #2
if(len>=1)
{
- for(std::size_t i=1;i<30;i++)
+ for(char i=1;i<30;i++)
{
std::string tmp1(nameTry.at(0),i);
tmp1+=nameTry;
m2D->setCoords(m3D->getCoords());
ret->setMeshAtLevel(0,m3D);
ret->setMeshAtLevel(-1,m2D);
- ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits<mcIdType>::max()-mem->get2DCellIdForExtrusion());
+ ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits<med_int>::max()-mem->get2DCellIdForExtrusion());
return ret.retn();
}
INTERP_KERNEL::AutoPtr<char> desc=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str);
MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str);
- int spaceDim=coo?coo->getNumberOfComponents():0;
+ int spaceDim=(int)(coo?coo->getNumberOfComponents():0);
int mdim(0);
if(!_ms.empty())
mdim=getMeshDimension();
const DataArrayDouble *coo=_coords;
if(!coo)
throw INTERP_KERNEL::Exception(" MEDFileUMesh::getSpaceDimension : no coords set !");
- return coo->getNumberOfComponents();
+ return (int)coo->getNumberOfComponents();
}
/*!
if(coords==(DataArrayDouble *)_coords)
return ;
coords->checkAllocated();
- int nbOfTuples(coords->getNumberOfTuples());
+ mcIdType nbOfTuples(coords->getNumberOfTuples());
_coords.takeRef(coords);
_fam_coords=DataArrayIdType::New();
_fam_coords->alloc(nbOfTuples,1);
if(coords==(DataArrayDouble *)_coords)
return ;
coords->checkAllocated();
- int nbOfTuples(coords->getNumberOfTuples());
+ mcIdType nbOfTuples(coords->getNumberOfTuples());
if(_coords.isNull())
{
_coords=coords;
}
else
{
- int oldNbTuples(_coords->getNumberOfTuples());
+ mcIdType oldNbTuples(_coords->getNumberOfTuples());
if(oldNbTuples!=nbOfTuples)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setCoordsForced : number of tuples is not the same -> invoke setCoords instead !");
_coords=coords;
void MEDFileUMesh::optimizeFamilies()
{
std::vector<int> levs=getNonEmptyLevelsExt();
- std::set<int> allFamsIds;
+ std::set<mcIdType> allFamsIds;
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
const DataArrayIdType *ffield=getFamilyFieldAtLevel(*it);
MCAuto<DataArrayIdType> ids=ffield->getDifferentValues();
- std::set<int> res;
+ std::set<mcIdType> res;
std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin()));
allFamsIds=res;
}
MCAuto<MEDCouplingUMesh> m3D(getMeshAtLevel(0)),m2D(getMeshAtLevel(-1));
if(m3D.isNull() || m2D.isNull())
throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : this must be defined both at level 0 and level -1 !");
- mcIdType zeId(std::numeric_limits<mcIdType>::max()-getFamilyId(GetSpeStr4ExtMesh()));
+ mcIdType zeId(std::numeric_limits<med_int>::max()-getFamilyId(GetSpeStr4ExtMesh()));
MCAuto<MEDCouplingMappedExtrudedMesh> ret(MEDCouplingMappedExtrudedMesh::New(m3D,m2D,zeId));
return ret.retn();
}
clearNonDiscrAttributes();
forceComputationOfParts();
tinyDouble.clear(); tinyInt.clear(); tinyStr.clear(); bigArraysI.clear(); bigArrayD=0;
- std::vector<int> layer0;
+ std::vector<mcIdType> layer0;
layer0.push_back(getAxisType());//0 i
layer0.push_back(_order); //1 i
layer0.push_back(_iteration);//2 i
tinyStr.push_back(_desc_name);//1 s
for(int i=0;i<getSpaceDimension();i++)
tinyStr.push_back(_coords->getInfoOnComponent(i));
- layer0.push_back((int)_families.size());//4 i <- key info aa layer#0
+ layer0.push_back(ToIdType(_families.size()));//4 i <- key info aa layer#0
for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
tinyStr.push_back((*it).first);
layer0.push_back((mcIdType)_groups.size());//4+aa i <- key info bb layer#0
for(std::map<std::string, std::vector<std::string> >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++)
{
- layer0.push_back((int)(*it0).second.size());
+ layer0.push_back(ToIdType((*it0).second.size()));
tinyStr.push_back((*it0).first);
for(std::vector<std::string>::const_iterator it1=((*it0).second).begin();it1!=((*it0).second).end();it1++)
tinyStr.push_back(*it1);
{
std::vector<mcIdType> tmp0;
pd->serialize(tmp0,bigArraysI);
- tinyInt.push_back(tmp0.size());
+ tinyInt.push_back(ToIdType(tmp0.size()));
tinyInt.insert(tinyInt.end(),tmp0.begin(),tmp0.end());
}
//
lev->serialize(layer1,bigArraysI);
}
// put layers all together.
- tinyInt.push_back(layer0.size());
+ tinyInt.push_back(ToIdType(layer0.size()));
tinyInt.insert(tinyInt.end(),layer0.begin(),layer0.end());
- tinyInt.push_back(layer1.size());
+ tinyInt.push_back(ToIdType(layer1.size()));
tinyInt.insert(tinyInt.end(),layer1.begin(),layer1.end());
}
std::reverse(bigArraysI.begin(),bigArraysI.end());
//
setAxisType((MEDCouplingAxisType)layer0.back()); layer0.pop_back();
- _order=layer0.back(); layer0.pop_back();
- _iteration=layer0.back(); layer0.pop_back();
- int spaceDim(layer0.back()); layer0.pop_back();
+ _order=FromIdType<int>(layer0.back()); layer0.pop_back();
+ _iteration=FromIdType<int>(layer0.back()); layer0.pop_back();
+ mcIdType spaceDim(layer0.back()); layer0.pop_back();
_time=tinyDouble.back(); tinyDouble.pop_back();
_name=tinyStr.back(); tinyStr.pop_back();
_desc_name=tinyStr.back(); tinyStr.pop_back();
const DataArrayDouble *coords(_coords);
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::addNodeGroup : no coords set !");
- int nbOfNodes(coords->getNumberOfTuples());
+ mcIdType nbOfNodes(coords->getNumberOfTuples());
if(_fam_coords.isNull())
{ _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); }
//
}
const DataArrayIdType *arr(globs->getProfile(st[0].getPflName()));
const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before
- mcIdType sz(nodesFetched.size());
+ mcIdType sz(ToIdType(nodesFetched.size()));
for(const mcIdType *work=arr->begin();work!=arr->end();work++)
{
std::vector<mcIdType> conn;
med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1));
//
if((const DataArrayIdType *)_fam_cells)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),ToMedIntArray(_fam_cells)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_fam_cells->getNumberOfTuples()),ToMedIntArray(_fam_cells)->getConstPointer()));
if((const DataArrayIdType *)_fam_faces)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),ToMedIntArray(_fam_faces)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_fam_faces->getNumberOfTuples()),ToMedIntArray(_fam_faces)->getConstPointer()));
if((const DataArrayIdType *)_fam_nodes)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),ToMedIntArray(_fam_nodes)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_fam_nodes->getNumberOfTuples()),ToMedIntArray(_fam_nodes)->getConstPointer()));
if((const DataArrayIdType *)_num_cells)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),ToMedIntArray(_num_cells)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_num_cells->getNumberOfTuples()),ToMedIntArray(_num_cells)->getConstPointer()));
if((const DataArrayIdType *)_num_faces)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),ToMedIntArray(_num_faces)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_num_faces->getNumberOfTuples()),ToMedIntArray(_num_faces)->getConstPointer()));
if((const DataArrayIdType *)_num_nodes)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),ToMedIntArray(_num_nodes)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_num_nodes->getNumberOfTuples()),ToMedIntArray(_num_nodes)->getConstPointer()));
if((const DataArrayAsciiChar *)_names_cells)
{
if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_names_cells->getNumberOfTuples()),_names_cells->getConstPointer()));
}
if((const DataArrayAsciiChar *)_names_faces)
{
oss << " ! The array has " << _names_faces->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_names_faces->getNumberOfTuples(),_names_faces->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_names_faces->getNumberOfTuples()),_names_faces->getConstPointer()));
}
if((const DataArrayAsciiChar *)_names_nodes)
{
oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_names_nodes->getNumberOfTuples()),_names_nodes->getConstPointer()));
}
//
MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa.c_str(),_families,_groups,_too_long_str);
for(int i=0;i<spaceDim;i++)
{
const DataArrayDouble *da=_cmesh->getCoordsAt(i);
- MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,ToMedInt(da->getNumberOfTuples()),da->getConstPointer()));
}
//
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
std::vector<mcIdType> nodeGridSt=_clmesh->getNodeGridStructure();
MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,ToMedIntArray(nodeGridSt)->getConstPointer()));
- MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin()));
//
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileStructuredMesh::writeStructuredLL(fid,meshName);
int MEDFileMeshes::getNumberOfMeshes() const
{
- return _meshes.size();
+ return (int)_meshes.size();
}
MEDFileMeshesIterator *MEDFileMeshes::iterator()
return new MEDFileUMeshPerTypeCommon;
}
-void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt,
+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;
return new MEDFileUMeshPerType(fid,mName,dt,it,mdim,geoElt,geoElt2,whichEntity,mrs);
}
-MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs)
+MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs)
{
int geoElt2i((int)geoElt2);
if(geoElt2i<0 || geoElt2i>=34)
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[3]={MED_CELL,MED_DESCENDING_FACE,MED_DESCENDING_EDGE};
- int nbOfElt=0;
+ mcIdType nbOfElt=0;
for(int i=0;i<3;i++)
{
med_bool changement,transformation;
- int tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(tmp>nbOfElt)
{
nbOfElt=tmp;
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
if(!cm.isDynamic())
{
}
void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs)
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
_pd=PartDefinition::New(strt,end,step);
if(!cm.isDynamic())
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPart : not implemented yet for the dynamic type !");
}
-void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
- int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
+ mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*curNbOfElem,1);
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer()));
- std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
+ std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn));
loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs);
}
-void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs)
{
if(strt<0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : start pos is negative !");
if(end>curNbOfElem)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : end is after the authorized range !");
- int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType"));
+ mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType"));
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
- int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
+ mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/nbOfNodesPerCell,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/ToMedInt(nbOfNodesPerCell),
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityAdvancedRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer()));
MEDfilterClose(&filter);
- std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
+ std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn));
loadPartOfCellCommonPart(fid,mName,strt,end,step,dt,it,mdim,curNbOfElem,geoElt,entity,mrs);
}
-void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
_fam=0;
- int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart"));
+ mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart"));
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
if(!mrs || mrs->isCellFamilyFieldReading())
{
- _fam=DataArrayIdType::New();
- _fam->alloc(nbOfEltsToLoad,1);
+ MCAuto<DataArrayMedInt> miFam(DataArrayMedInt::New());
+ miFam->alloc(nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
- if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,_fam->getPointer())!=0)
- _fam->fillWithZero();
+ if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,miFam->getPointer())!=0)
+ miFam->fillWithZero();
+ _fam=FromMedIntArray<mcIdType>(miFam);
MEDfilterClose(&filter);
}
}
{
if(!mrs || mrs->isCellNumFieldReading())
{
- _num=DataArrayIdType::New();
- _num->alloc(nbOfEltsToLoad,1);
+ MCAuto<DataArrayMedInt> miNum(DataArrayMedInt::New());
+ miNum->alloc(nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
- if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,_num->getPointer())!=0)
- _num->fillWithZero();
+ if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,miNum->getPointer())!=0)
+ miNum->fillWithZero();
+ _num=FromMedIntArray<mcIdType>(miNum);
MEDfilterClose(&filter);
}
}
_names=DataArrayAsciiChar::New();
_names->alloc(nbOfEltsToLoad+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
med_filter filter=MED_FILTER_INIT;
- MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
+ MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
+ /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NAME,dt,it,entity,geoElt,&filter,_names->getPointer())!=0)
_names=0;
}
}
-void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt,
+void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- med_int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG);
MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCast<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New());
conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1);
MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer()));
- std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
- std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus<int>(),-1));
+ std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
+ std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus<med_int>(),-1));
mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn),FromMedIntArray<mcIdType>(connI));
loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs);
}
-void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
+void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
med_int indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation));
- int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1);
+ mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYHED);
MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCastSafe<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
- INTERP_KERNEL::AutoPtr<int> index=new int[curNbOfElem+1];
- INTERP_KERNEL::AutoPtr<int> indexFace=new int[indexFaceLgth];
- INTERP_KERNEL::AutoPtr<int> locConn=new int[connFaceLgth];
+ INTERP_KERNEL::AutoPtr<med_int> index=new med_int[curNbOfElem+1];
+ INTERP_KERNEL::AutoPtr<med_int> indexFace=new med_int[indexFaceLgth];
+ INTERP_KERNEL::AutoPtr<med_int> locConn=new med_int[connFaceLgth];
MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn));
MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
- int arraySize=connFaceLgth;
- for(int i=0;i<curNbOfElem;i++)
+ mcIdType arraySize=connFaceLgth;
+ for(mcIdType i=0;i<curNbOfElem;i++)
arraySize+=index[i+1]-index[i]-1;
conn=DataArrayIdType::New();
conn->alloc(arraySize,1);
void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names)
{
- int nbOfCells=m->getNumberOfCells();
+ mcIdType nbOfCells=m->getNumberOfCells();
if(nbOfCells<1)
return ;
int dt,it;
if(!m0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !");
MCAuto<DataArrayMedInt> arr(DataArrayMedInt::Copy(m0->getNodalConnectivity()));
- std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
- MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin()));
+ std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<med_int>(),1));
+ MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,ToMedInt(nbOfCells),arr->begin()));
}
else
{
if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG)
{
MCAuto<DataArrayMedInt> arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())),arrI(DataArrayMedInt::Copy(m0->getNodalConnectivityIndex()));
- std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
- std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<int>(),1));
- MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin()));
+ std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<med_int>(),1));
+ std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<med_int>(),1));
+ MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,ToMedInt(nbOfCells+1),arrI->begin(),arr->begin()));
}
else
{
const mcIdType *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin());
mcIdType meshLgth=m0->getNodalConnectivityLength();
- mcIdType nbOfFaces=std::count(conn,conn+meshLgth,-1)+nbOfCells;
+ mcIdType nbOfFaces=ToIdType(std::count(conn,conn+meshLgth,-1)+nbOfCells);
INTERP_KERNEL::AutoPtr<med_int> tab1=new med_int[nbOfCells+1];
med_int *w1=tab1; *w1=1;
INTERP_KERNEL::AutoPtr<med_int> tab2=new med_int[nbOfFaces+1];
{
const mcIdType *wend=std::find(w,conn+connI[i+1],-1);
bt=std::transform(w,wend,bt,std::bind2nd(std::plus<mcIdType>(),1));
- int nbOfNode=std::distance(w,wend);
- w2[1]=w2[0]+nbOfNode;
+ std::size_t nbOfNode=std::distance(w,wend);
+ w2[1]=w2[0]+(med_int)nbOfNode;
if(wend!=conn+connI[i+1])
w=wend+1;
else
}
w1[1]=w1[0]+nbOfFaces2;
}
- MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab));
+ MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,ToMedInt(nbOfCells+1),tab1,ToMedInt(nbOfFaces+1),tab2,bigtab));
}
}
if(fam)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray<mcIdType>(fam)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray<mcIdType>(fam)->getConstPointer()));
if(num)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray<mcIdType>(num)->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray<mcIdType>(num)->getConstPointer()));
if(names)
{
if(names->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << names->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),names->getConstPointer()));
}
}
{
public:
static MEDFileUMeshPerTypeCommon *New();
- void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt,
+ void loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
{
public:
static MEDFileUMeshPerType *New(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType geoElt2, MEDFileMeshReadSelector *mrs);
- static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs);
+ static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs);
static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
void loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs);
- void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs);
+ void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
- void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
- med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs);
- void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt,
+ void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
+ med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs);
+ void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
- void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
+ void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt,
med_entity_type entity, MEDFileMeshReadSelector *mrs);
- void loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs);
+ void loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs);
private:
MCAuto<MEDCoupling1GTUMesh> _m;
MCAuto<PartDefinition> _pd;
return ;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
- mcIdType nfam=MEDnFamily(fid,meshName.c_str());
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > > crudeFams(nfam);
- for(mcIdType i=0;i<nfam;i++)
+ for(med_int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
std::vector<std::string> grps(ngro);
for(int j=0;j<ngro;j++)
grps[j]=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
- crudeFams[i]=std::pair<std::string,std::pair<int,std::vector<std::string> > >(famName,std::pair<int,std::vector<std::string> >(numfam,grps));
+ crudeFams[i]=std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > >(famName,std::pair<mcIdType,std::vector<std::string> >(numfam,grps));
}
RenameFamiliesFromFileToMemInternal(crudeFams);
for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++)
RenameFamiliesFromMemToFileInternal(crudeFams);
for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++)
{
- mcIdType ngro((*it).second.second.size());
+ std::size_t ngro((*it).second.second.size());
INTERP_KERNEL::AutoPtr<char> groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro);
int i=0;
for(std::vector<std::string>::const_iterator it2=(*it).second.second.begin();it2!=(*it).second.second.end();it2++,i++)
MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE,groName+i*MED_LNAME_SIZE,tooLongStrPol);
INTERP_KERNEL::AutoPtr<char> famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol);
- int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second.first,ngro,groName);
+ med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt((*it).second.first),ToMedInt(ngro),groName);
ret++;
}
}
for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
(*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds);
- mcIdType nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)));
- mcIdType nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)));
+ mcIdType nMin(ToIdType(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))));
+ mcIdType nMax(ToIdType(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true))));
nMax=nCoords-nMax;
for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
_coords->setInfoOnComponent(i,infosOnComp[i]);
}
-void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax)
+void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector<std::string>& 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));
_coords=DataArrayDouble::New();
- int nbNodesToLoad(nMax-nMin);
+ mcIdType nbNodesToLoad(nMax-nMin);
_coords->alloc(nbNodesToLoad,spaceDim);
med_filter filter=MED_FILTER_INIT,filter2=MED_FILTER_INIT;
MEDfilterBlockOfEntityCr(fid,/*nentity*/nCoords,/*nvaluesperentity*/1,/*nconstituentpervalue*/spaceDim,
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
- /*start*/nMin+1,/*stride*/1,/*count*/1,/*blocksize*/nbNodesToLoad,
+ /*start*/ToMedInt(nMin+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbNodesToLoad),
/*lastblocksize=useless because count=1*/0,&filter);
MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateAdvancedRd,(fid,mName.c_str(),dt,it,&filter,_coords->getPointer()));
_part_coords=PartDefinition::New(nMin,nMax,1);
MEDfilterClose(&filter);
MEDfilterBlockOfEntityCr(fid,nCoords,1,1,MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,
- MED_NO_PROFILE,nMin+1,1,1,nbNodesToLoad,0,&filter2);
+ MED_NO_PROFILE,ToMedInt(nMin+1),1,1,ToMedInt(nbNodesToLoad),0,&filter2);
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
MCAuto<DataArrayMedInt> miFamCoord=DataArrayMedInt::New();
{
if(!coords)
return ;
- MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin()));
if(famCoords)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),ToMedIntArray<mcIdType>(famCoords)->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(famCoords->getNumberOfTuples()),ToMedIntArray<mcIdType>(famCoords)->begin()));
if(numCoords)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),ToMedIntArray<mcIdType>(numCoords)->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(numCoords->getNumberOfTuples()),ToMedIntArray<mcIdType>(numCoords)->begin()));
if(nameCoords)
{
if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(nameCoords->getNumberOfTuples()),nameCoords->begin()));
}
if(globalNumCoords)
- MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),ToMedIntArray<mcIdType>(globalNumCoords)->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,ToMedInt(globalNumCoords->getNumberOfTuples()),ToMedIntArray<mcIdType>(globalNumCoords)->begin()));
}
bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const
const std::vector< MCAuto<MEDFileUMeshPerType> >& v=l2.getLev(id);
if(v.empty())
return;
- int sz=v.size();
+ std::size_t sz=v.size();
std::vector<const MEDCoupling1GTUMesh *> ms(sz);
std::vector<const DataArrayIdType *> fams(sz),nums(sz);
std::vector<const DataArrayChar *> names(sz);
std::vector<const PartDefinition *> pds(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
MEDCoupling1GTUMesh *elt(v[i]->getMesh());
MCAuto<DataArrayDouble> tmp2=l2.getCoords();
_m_by_types.assignDefParts(pds);
if(l2.isFamDefinedOnLev(id))
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fams[i]=v[i]->getFam();
if(sz!=1)
_fam=DataArrayIdType::Aggregate(fams);
}
if(l2.isNumDefinedOnLev(id))
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
nums[i]=v[i]->getNum();
if(sz!=1)
_num=DataArrayIdType::Aggregate(nums);
}
if(l2.isNamesDefinedOnLev(id))
{
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
names[i]=v[i]->getNames();
_names=dynamic_cast<DataArrayAsciiChar *>(DataArrayChar::Aggregate(names));
}
void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
void loadCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it);
- void loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax);
- int getNumberOfLevels() const { return _per_type_mesh.size(); }
+ void loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax);
+ int getNumberOfLevels() const { return (int)_per_type_mesh.size(); }
bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); }
const std::vector< MCAuto<MEDFileUMeshPerType> >& getLev(int levId) const { return _per_type_mesh[levId]; }
bool isFamDefinedOnLev(int levId) const;
throw INTERP_KERNEL::Exception(oss.str());
}
-int MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const
+mcIdType MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const
{
const MEDFileUMesh *sup(getSupMeshWithName(name));
switch(entity)
MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::vector<std::string> getSupMeshNames() const;
MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
- MEDLOADER_EXPORT int getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const;
private:
MEDFileMeshSupports(med_idt fid);
MEDFileMeshSupports();
med_attribute_type constatttype;
int nbCompo;
med_entity_type met;
- int pflSz;
- MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&pflSz));
+ med_int miPflSz;
+ MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&miPflSz));
std::string name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE));
setName(name);
setProfile(MEDLoaderBase::buildStringFromFortran(profilename,MED_NAME_SIZE));
//
_val=MEDFileStructureElement::BuildFrom(constatttype);
nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,nbCompo);
+ mcIdType pflSz = miPflSz;
if(pflSz==0 && getProfile().empty())
{
switch(met)
INTERP_KERNEL::AutoPtr<char> varattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
med_attribute_type varatttype;
{
- int pflSz;
+ //int pflSz;
MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&_nb_compo));
}
setName(MEDLoaderBase::buildStringFromFortran(varattname,MED_NAME_SIZE));
int MEDFileStructureElements::getNumberOf() const
{
- return _elems.size();
+ return (int)_elems.size();
}
std::vector<int> MEDFileStructureElements::getDynGTAvail() const
throw INTERP_KERNEL::Exception(oss.str());
}
-int MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const
+mcIdType MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const
{
if(seName=="MED_PARTICLE")
return 1;
MEDLOADER_EXPORT int getNumberOf() const;
MEDLOADER_EXPORT std::vector<int> getDynGTAvail() const;
MEDLOADER_EXPORT const MEDFileStructureElement *getWithGT(int idGT) const;
- MEDLOADER_EXPORT int getNumberOfNodesPerSE(const std::string& seName) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodesPerSE(const std::string& seName) const;
MEDLOADER_EXPORT const MEDFileStructureElement *getSEWithName(const std::string& seName) const;
MEDLOADER_EXPORT std::vector<std::string> getVarAttsOf(const std::string& seName) const;
MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const;
#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
#include "MEDLoader.hxx"
+#include "MEDFileBasis.hxx"
#include "InterpKernelAutoPtr.hxx"
med_access_mode medmod(MEDFileUtilities::TraduceWriteMode(mode));
MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),medmod));
std::ostringstream oss; oss << "MEDFileWritableStandAlone : error on attempt to write in file : \"" << fileName << "\"";
- MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
+ MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str());
writeLL(fid);
}
}
med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
- {
+{
if(meshName.empty())
{
std::vector<std::string> meshes=getMeshNamesFid(fid);
throw INTERP_KERNEL::Exception(os2.str().c_str());
}
trueMeshName=meshName;
- return iter-meshes.begin()+1;
- }
+ return ToMedInt( iter-meshes.begin()+1 );
+}
std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
{
return EXIST_RW;
}
-char *MEDLoaderBase::buildEmptyString(int lgth)
+char *MEDLoaderBase::buildEmptyString(std::size_t lgth)
{
char *ret=new char[lgth+1];
std::fill(ret,ret+lgth,' ');
return ;
}
}
- int n(strlen(src));
+ std::size_t n(strlen(src));
std::fill(dest,dest+maxLgth,' ');
strncpy(dest,src,n);
}
{
public:
static int getStatusOfFile(const std::string& fileName);
- static char *buildEmptyString(int lgth);
+ static char *buildEmptyString(std::size_t lgth);
static void getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName);
static std::string getPathSep();
static std::string joinPath(const std::string& dirName, const std::string& baseName);
TInt GetNbRef() const { return myNbRef; }
- TCoordSlice GetCoord(TInt theRefId) { return &myRefCoord[0] + theRefId * myDim; }
+ TCoordSlice GetCoord(std::size_t theRefId) { return &myRefCoord[0] + theRefId * myDim; }
};
//---------------------------------------------------------------
/*!
TGaussDef(const int geomType, const int nbPoints, const int variant=1);
int dim() const { return SauvUtilities::getDimension( NormalizedCellType( myType )); }
- int nbPoints() const { return myWeights.capacity(); }
+ std::size_t nbPoints() const { return myWeights.capacity(); }
private:
void add(const double x, const double weight);
THexa20a::THexa20a(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
THexa27a::THexa27a():
THexa20a(3,27)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 20: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break;
THexa20b::THexa20b(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
TPenta6a::TPenta6a():
TShapeFun(3,6)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPenta6b::TPenta6b():
TShapeFun(3,6)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPenta15a::TPenta15a():
TShapeFun(3,15)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPenta15b::TPenta15b():
TShapeFun(3,15)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
TPyra5a::TPyra5a():
TShapeFun(3,5)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
TPyra5b::TPyra5b():
TShapeFun(3,5)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
TPyra13a::TPyra13a():
TShapeFun(3,13)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
TPyra13b::TPyra13b():
TShapeFun(3,13)
{
- TInt aNbRef = myRefCoord.size();
- for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ std::size_t aNbRef = myRefCoord.size();
+ for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
SauvUtilities::Link Cell::link(int i) const
{
- int i2 = ( i + 1 ) % _nodes.size();
+ std::size_t i2 = ( i + 1 ) % _nodes.size();
if ( _reverse )
return std::make_pair( _nodes[i2]->_number, _nodes[i]->_number );
else
*/
//================================================================================
-int Group::size() const
+mcIdType Group::size() const
{
- int sizze = 0;
+ std::size_t sizze = 0;
if ( !_relocTable.empty() )
sizze = _relocTable.size();
else if ( _medGroup )
else
for ( size_t i = 0; i < _groups.size(); ++i )
sizze += _groups[i]->size();
- return sizze;
+ return ToIdType( sizze );
}
//================================================================================
bool aResult = true;
// Check the state of the buffer;
// if there is too little left, read the next portion of data
- int nBytesRest = _eptr - _ptr;
+ std::size_t nBytesRest = _eptr - _ptr;
if (nBytesRest < GIBI_MaxOutputLen)
{
if (nBytesRest > 0)
{
// move the remaining portion to the buffer beginning
- for ( int i = 0; i < nBytesRest; ++i )
+ for ( std::size_t i = 0; i < nBytesRest; ++i )
_start[i] = _ptr[i];
//memcpy (_tmpBuf, _ptr, nBytesRest);
//memcpy (_start, _tmpBuf, nBytesRest);
nBytesRest = 0;
}
_ptr = _start;
- const int nBytesRead = ::read (_file,
- &_start [nBytesRest],
- GIBI_BufferSize - nBytesRest);
+ const std::size_t nBytesRead = ::read (_file,
+ &_start [nBytesRest],
+ GIBI_BufferSize - nBytesRest);
nBytesRest += nBytesRead;
_eptr = &_start [nBytesRest];
}
float ASCIIReader::getFloat() const
{
- return getDouble();
+ return (float)getDouble();
}
//================================================================================
// correct pointers to sub-groups
for ( size_t j = 0; j < _groups[i]._groups.size(); ++j )
{
- int iG = _groups[i]._groups[j] - &_groups[0];
+ std::size_t iG = _groups[i]._groups[j] - &_groups[0];
newGroups[i]._groups[j] = & newGroups[ iG ];
}
}
for ( size_t i = 0; i < groupsToFix->size(); ++i )
if ( (*groupsToFix)[i] )
{
- int iG = (*groupsToFix)[i] - &_groups[0];
+ std::size_t iG = (*groupsToFix)[i] - &_groups[0];
(*groupsToFix)[i] = & newGroups[ iG ];
}
for ( size_t j = 0; j < fields[i]->_sub.size(); ++j )
if ( fields[i]->_sub[j]._support )
{
- int iG = fields[i]->_sub[j]._support - &_groups[0];
+ std::size_t iG = fields[i]->_sub[j]._support - &_groups[0];
fields[i]->_sub[j]._support = & newGroups[ iG ];
}
if ( fields[i]->_group )
{
- int iG = fields[i]->_group - &_groups[0];
+ std::size_t iG = fields[i]->_group - &_groups[0];
fields[i]->_group = & newGroups[ iG ];
}
}
if (medName.find( fields[ifi]->_name + "." ) == 0 )
{
std::vector<DoubleField::_Sub_data>& aSubDs = fields[ifi]->_sub;
- int nbSub = aSubDs.size();
- for (int isu = 0; isu < nbSub; isu++)
+ std::size_t nbSub = aSubDs.size();
+ for (std::size_t isu = 0; isu < nbSub; isu++)
for (int ico = 0; ico < aSubDs[isu].nbComponents(); ico++)
{
if (aSubDs[isu].compName(ico) == gibiName)
for ( size_t j = 0; j < grp._cells.size(); ++j )
if ( faces.insert( grp._cells[j] ).second )
{
- for ( size_t k = 0; k < grp._cells[j]->_nodes.size(); ++k )
+ for ( unsigned int k = 0; k < grp._cells[j]->_nodes.size(); ++k )
linkFacesMap[ grp._cells[j]->link( k ) ].push_back( grp._cells[j] );
fgm.insert( std::make_pair( grp._cells[j], &grp ));
}
// check if re-numeration is needed (to try to keep elem oreder as in sauve file )
bool ok = true, renumEntity = false;
CellsByDimIterator cellsIt( *this, dim );
- int prevNbElems = 0;
+ mcIdType prevNbElems = 0;
while ( const std::set<Cell> * typeCells = cellsIt.nextType() )
{
TID minNumber = std::numeric_limits<TID>::max(), maxNumber = 0;
if ( elemIt->_number < minNumber ) minNumber = elemIt->_number;
if ( elemIt->_number > maxNumber ) maxNumber = elemIt->_number;
}
- TID typeSize = typeCells->size();
+ mcIdType typeSize = ToIdType( typeCells->size() );
if ( typeSize != maxNumber - minNumber + 1 )
ok = false;
if ( prevNbElems+1 != (int)minNumber )
if ( ok && renumEntity ) // each geom type was numerated separately
{
cellsIt.init( dim );
- prevNbElems = cellsIt.nextType()->size(); // no need to renumber the first type
+ prevNbElems = ToIdType( cellsIt.nextType()->size()); // no need to renumber the first type
while ( const std::set<Cell> * typeCells = cellsIt.nextType() )
{
for ( elemIt = typeCells->begin(), elemEnd = typeCells->end(); elemIt!=elemEnd; ++elemIt)
elemIt->_number += prevNbElems;
- prevNbElems += typeCells->size();
+ prevNbElems += ToIdType( typeCells->size() );
}
}
if ( !ok )
DataArrayDouble* coordArray = DataArrayDouble::New();
coordArray->alloc( _nbNodes, _spaceDim );
double * coordPrt = coordArray->getPointer();
- for ( int i = 0, nb = _points.size(); i < nb; ++i )
+ for ( unsigned int i = 0; i < _points.size(); ++i )
{
Node* n = getNode( i+1 );
if ( n->isUsed() )
{
CellsByDimIterator dimCells( *this, dim );
- int nbOfCells = 0;
+ mcIdType nbOfCells = 0;
while ( const std::set<Cell > * cells = dimCells.nextType() )
- nbOfCells += cells->size();
+ nbOfCells += ToIdType( cells->size() );
if ( nbOfCells == 0 )
continue;
dimMesh->setMeshDimension( dim );
dimMesh->allocateCells( nbOfCells );
- int prevNbCells = 0;
+ mcIdType prevNbCells = 0;
dimCells.init( dim );
while ( const std::set<Cell > * cells = dimCells.nextType() )
{
// fill connectivity array to take into account order of elements in the sauv file
- const int nbCellNodes = cells->begin()->_nodes.size();
+ const mcIdType nbCellNodes = ToIdType( cells->begin()->_nodes.size() );
std::vector< TID > connectivity( cells->size() * nbCellNodes );
TID * nodalConnOfCell;
for ( elemIt = cells->begin(), elemEnd = cells->end(); elemIt != elemEnd; ++elemIt )
{
const Cell& cell = *elemIt;
- const int index = cell._number - 1 - prevNbCells;
+ const TID index = cell._number - 1 - prevNbCells;
nodalConnOfCell = &connectivity[ index * nbCellNodes ];
if ( cell._reverse )
- for ( int i = nbCellNodes-1; i >= 0; --i )
+ for ( mcIdType i = nbCellNodes-1; i >= 0; --i )
*nodalConnOfCell++ = cell._nodes[i]->_number - 1;
else
- for ( int i = 0; i < nbCellNodes; ++i )
+ for ( mcIdType i = 0; i < nbCellNodes; ++i )
*nodalConnOfCell++ = cell._nodes[i]->_number - 1;
}
- prevNbCells += cells->size();
+ prevNbCells += ToIdType( cells->size() );
// fill dimMesh
TCellType cellType = dimCells.type();
{
int dim = getDim( grp );
- int nbElems = 0;
+ mcIdType nbElems = 0;
if ( dim == 0 )
{
nbElems = _nbNodes;
{
CellsByDimIterator dimCells( *this, dim );
while ( const std::set<Cell > * cells = dimCells.nextType() )
- nbElems += cells->size();
+ nbElems += ToIdType( cells->size() );
int meshDim = 3;
for ( ; meshDim > 0; --meshDim )
MEDFileFields* fields = MEDFileFields::New();
- for ( size_t i = 0; i < _nodeFields.size(); ++i )
+ for ( unsigned int i = 0; i < _nodeFields.size(); ++i )
setFields( _nodeFields[i], fields, mesh, i+1, usedFieldNames );
- for ( size_t i = 0; i < _cellFields.size(); ++i )
+ for ( unsigned int i = 0; i < _cellFields.size(); ++i )
setFields( _cellFields[i], fields, mesh, i+1, usedFieldNames );
return fields;
std::cout << "Castem field #" << castemID << " <" << fld->_name
<< "> is incompatible with MED format, so we split it into several fields:" << std::endl;
- for ( size_t iSub = 0; iSub < fld->_sub.size(); )
+ for ( unsigned int iSub = 0; iSub < fld->_sub.size(); )
{
// set field name
if ( !uniteSubs || fld->_name.empty() )
double * valPtr = values->getPointer();
if ( uniteSubs )
{
- int nbElems = fld->_group->size();
- for ( int elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); )
+ mcIdType nbElems = fld->_group->size();
+ for ( mcIdType elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); )
elemShift += fld->setValues( valPtr, iSub++, elemShift );
setTS( fld, values, medFields, mesh );
}
bool DoubleField::isMedCompatible(bool& sameNbGauss) const
{
- for ( size_t iSub = 0; iSub < _sub.size(); ++iSub )
+ for ( unsigned int iSub = 0; iSub < _sub.size(); ++iSub )
{
if ( !getSupport(iSub) || !getSupport(iSub)->_medGroup )
THROW_IK_EXCEPTION("SauvReader INTERNAL ERROR: NULL field support");
*/
//================================================================================
-int DoubleField::getNbTuples( const int iSub ) const
+mcIdType DoubleField::getNbTuples( const int iSub ) const
{
- int nb = 0;
+ mcIdType nb = 0;
if ( hasCommonSupport() && !_group->_groups.empty() )
for ( size_t i = 0; i < _group->_groups.size(); ++i )
nb += _sub[i].nbGauss() * _sub[i]._support->size();
*/
//================================================================================
-int DoubleField::setValues( double * valPtr, const int iSub, const int elemShift ) const
+mcIdType DoubleField::setValues( double * valPtr, const int iSub, const mcIdType elemShift ) const
{
// find values for iSub
int iComp = 0;
// Set values
- const std::vector< unsigned >& relocTable = getSupport( iSub )->_relocTable;
+ const std::vector< mcIdType >& relocTable = getSupport( iSub )->_relocTable;
- const int nbElems = _sub[iSub]._support->size();
+ const mcIdType nbElems = _sub[iSub]._support->size();
const int nbGauss = _sub[iSub].nbGauss();
const int nbComponents = _sub[iSub].nbComponents();
const int nbValsByElem = nbComponents * nbGauss;
// check nb values
- int nbVals = 0;
+ mcIdType nbVals = 0;
for ( iComp = 0; iComp < nbComponents; ++iComp )
- nbVals += compValues[iComp].size();
+ nbVals += ToIdType( compValues[iComp].size() );
const bool isConstField = ( nbVals == nbComponents ); // one value per component (issue 22321)
if ( !isConstField && nbVals != nbElems * nbValsByElem )
THROW_IK_EXCEPTION("SauvMedConvertor.cxx: support size mismatches field size");
// compute nb values in previous subs
- int valsShift = 0;
- for ( int iS = iSub-1, shift = elemShift; shift > 0; --iS)
+ mcIdType valsShift = 0;
+ for ( mcIdType iS = iSub-1, shift = elemShift; shift > 0; --iS)
{
- int nbE = _sub[iS]._support->size();
+ mcIdType nbE = _sub[iS]._support->size();
shift -= nbE;
valsShift += nbE * _sub[iS].nbComponents() * _sub[iS].nbGauss();
}
if ( isConstField )
- for ( int iE = 0; iE < nbElems; ++iE )
+ for ( mcIdType iE = 0; iE < nbElems; ++iE )
{
- int iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
+ mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
for ( iComp = 0; iComp < nbComponents; ++iComp )
valPtr[ iMed + iComp ] = compValues[iComp][ 0 ];
}
else
- for ( int iE = 0; iE < nbElems; ++iE )
+ for ( mcIdType iE = 0; iE < nbElems; ++iE )
{
- int iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
+ mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
for ( iComp = 0; iComp < nbComponents; ++iComp )
for ( int iG = 0; iG < nbGauss; ++iG )
valPtr[ iMed + iG * nbComponents + iComp ] = compValues[iComp][ iE * nbGauss + iG ];
(issue 0021311)
*/
MEDCoupling::DataArrayIdType* _medGroup; // result of conversion
- std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup
+ std::vector< mcIdType > _relocTable; // for _cells[i] gives its index in _medGroup
bool empty() const { return _cells.empty() && _groups.empty(); }
- int size() const;
+ mcIdType size() const;
Group():_cellType(INTERP_KERNEL::NORM_ERROR), _isProfile(false), _medGroup(NULL) {}
};
void setData( int nb_comp, Group* supp )
{ _support = supp; _comp_names.resize(nb_comp); _nb_gauss.resize(nb_comp,1); }
- int nbComponents() const { return _comp_names.size(); }
+ int nbComponents() const { return (int)_comp_names.size(); }
std::string & compName( int i_comp ) { return _comp_names[ i_comp ]; }
bool isSameNbGauss() const { return *std::max_element( _nb_gauss.begin(), _nb_gauss.end() ) ==
*std::min_element( _nb_gauss.begin(), _nb_gauss.end() ); }
bool isMedCompatible(bool& sameNbGauss) const;
MEDCoupling::TypeOfField getMedType( const int iSub=0 ) const;
MEDCoupling::TypeOfTimeDiscretization getMedTimeDisc() const;
- int getNbTuples( const int iSub=0 ) const;
+ mcIdType getNbTuples( const int iSub=0 ) const;
int getNbValuesPerElement( const int iSub=0 ) const;
int getNbGauss( const int iSub=0 ) const;
const Group* getSupport( const int iSub=0 ) const;
- int setValues( double * valPtr, const int iSub, const int elemShift=0 ) const;
+ mcIdType setValues( double * valPtr, const int iSub, const mcIdType elemShift=0 ) const;
void splitSubWithDiffNbGauss();
//virtual void dump(std::ostream&) const;
~IntermediateMED();
Node* getNode( TID nID ) { return _points.getNode( nID ); }
- int getNbCellsOfType( TCellType type ) const { return _cellsByType[type].size(); }
+ mcIdType getNbCellsOfType( TCellType type ) const { return ToIdType(_cellsByType[type].size()); }
const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); }
Group* addNewGroup(std::vector<SauvUtilities::Group*>* groupsToFix=0);
MEDCoupling::MEDFileData* convertInMEDFileDS();
while ( isSwapped )
{
isSwapped = false;
- for ( size_t i = 1; i < groups.size(); ++i )
+ for ( std::size_t i = 1; i < groups.size(); ++i )
{
- int nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
- int nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
+ std::size_t nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size();
+ std::size_t nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size();
if ( nbN1 > nbN2 )
{
isSwapped = isModified = true;
const int fixedLength = 71;
while ((int)aWholeString.length() < stringLen)
{
- int remainLen = stringLen - aWholeString.length();
+ int remainLen = (int)(stringLen - aWholeString.length());
int len;
if ( remainLen > fixedLength )
{
while ((int)aWholeString.length() < stringLen)
{
getNextLine( line );
- int remainLen = stringLen - aWholeString.length();
+ int remainLen = (int)(stringLen - aWholeString.length());
if ( remainLen > fixedLength )
{
aWholeString += line + 1;
if (!healedName.empty())
{
string name = healedName;
- int len = name.length();
- for (int i = 0; i < len; ++i)
- name[i] = toupper(name[i]);
+ std::size_t len = name.length();
+ for (std::size_t i = 0; i < len; ++i)
+ name[i] = (char)toupper(name[i]);
bool doResave = false; // only for tracing
void SauvWriter::fillSubMeshes( int& nbSauvObjects, map<string,int>& nameNbMap )
{
// evaluate nb of _subs in order to avoid re-allocation of _subs
- int nbSubs = 1; // for the very mesh
+ std::size_t nbSubs = 1; // for the very mesh
nbSubs += _fileMesh->getFamilyInfo().size() + 4; // + 4 zero families (for each dimRelExt)
nbSubs += _fileMesh->getGroupInfo().size();
nbSubs += evaluateNbProfileSubMeshes();
mcIdType curFamID = 0;
SubMesh* curSubMesh = addSubMesh( "", dimRelExt ); // submesh of zero family
_famIDs2Sub[0] = curSubMesh;
- int sub0Index = _subs.size()-1;
+ std::size_t sub0Index = _subs.size()-1;
const mcIdType * famID = famIds->begin(), * famIDEnd = famIds->end();
for ( mcIdType cellID = 0; famID < famIDEnd; ++famID, cellID++ )
else if ( dimRelExt == 0 )
{
// make a submesh including all cells
- if ( sub0Index == (int)(_subs.size()-1) )
+ if ( sub0Index == _subs.size()-1 )
{
_famIDs2Sub[0]->_name = _fileMesh->getName(); // there is the zero family only
}
curSubMesh = addSubMesh( _fileMesh->getName(), dimRelExt );
if ( _famIDs2Sub[0]->nbTypes() == 0 )
sub0Index++; // skip an empty zero family
- for ( size_t i = sub0Index; i < _subs.size()-1; ++i )
+ for ( std::size_t i = sub0Index; i < _subs.size()-1; ++i )
curSubMesh->_subs.push_back( & _subs[i] );
}
}
int SauvWriter::evaluateNbProfileSubMeshes() const
{
- int nb = 0;
- for ( size_t i = 0; i < _nodeFields.size(); ++i )
+ std::size_t nb = 0;
+ for ( std::size_t i = 0; i < _nodeFields.size(); ++i )
nb += 1 + _nodeFields[i]->getPflsReallyUsed().size();
- for ( size_t i = 0; i < _cellFields.size(); ++i )
+ for ( std::size_t i = 0; i < _cellFields.size(); ++i )
{
nb += _cellFields[i]->getPflsReallyUsed().size();
nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time
}
- return nb;
+ return (int)nb;
}
//================================================================================
void SauvWriter::makeProfileIDs( SubMesh* sm,
INTERP_KERNEL::NormalizedCellType type,
- const DataArrayIdType* profile )
+ const DataArrayIdType* profile )
{
MCAuto< MEDCouplingMesh >
mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt);
const MEDCouplingUMesh* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh );
if ( sm->_dimRelExt == 1 ) type = INTERP_KERNEL::NORM_POINT1;
- vector< int >& ids = sm->_cellIDsByType[ type ];
+ vector< mcIdType >& ids = sm->_cellIDsByType[ type ];
if ( sm->_dimRelExt == 1 || !uMesh )
{
{
ids.resize( sm->_dimRelExt == 1 ? mesh->getNumberOfNodes() : mesh->getNumberOfCells() );
for ( size_t i = 0; i < ids.size(); ++i )
- ids[i]=i;
+ ids[i] = ToIdType( i );
}
}
else
}
else // mesh includes only one type
{
- int nbE = code[1];
+ mcIdType nbE = code[1];
for ( ids.resize( nbE ); nbE; --nbE )
ids[ nbE-1 ] = nbE-1;
}
TFieldCounter fcount( *_sauvFile, 10 ); // 10 integers per line
- for ( size_t iSub = 0; iSub < _subs.size(); ++iSub )
+ for ( unsigned int iSub = 0; iSub < _subs.size(); ++iSub )
{
SubMesh& sm = _subs[iSub];
if ( sm._nbSauvObjects < 1 ) continue;
for ( int iType=0; iType < sm.cellIDsByTypeSize(); ++iType )
{
- const vector<int>& cellIDs = sm._cellIDsByType[iType];
+ const vector<mcIdType>& cellIDs = sm._cellIDsByType[iType];
if ( cellIDs.empty() ) continue;
INTERP_KERNEL::NormalizedCellType
cell = INTERP_KERNEL::CellModel::GetCellModel( cellType );
int castemType = SauvUtilities::med2gibiGeom( cellType );
unsigned nbElemNodes = cell.getNumberOfNodes();
- unsigned nbElems = cellIDs.size();
+ std::size_t nbElems = cellIDs.size();
*_sauvFile << setw(8) << castemType
<< zeroI8
// write color of each element
// * 8000 FORMAT(10I8)
- for ( size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8;
+ for ( std::size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8;
fcount.stop();
// write connectivity
// gibi IDs are in FORTRAN mode while MEDCoupling IDs are in C mode
if ( sm._dimRelExt == 1 ) // nodes
{
- for ( size_t i = 0; i < nbElems; ++i, fcount++ )
+ for ( std::size_t i = 0; i < nbElems; ++i, fcount++ )
*_sauvFile << setw(8) << ( cellIDs[i] + 1 );
}
else
const int * toMedConn = getGibi2MedQuadraticInterlace( cellType );
vector< mcIdType > cellConn( nbElemNodes ), transformedConn( nbElemNodes );
- for ( size_t i = 0; i < nbElems; ++i )
+ for ( std::size_t i = 0; i < nbElems; ++i )
{
cellConn.clear();
umesh->getNodeIdsOfCell( cellIDs[i], cellConn );
// write the index connecting nodes with their coordinates
- const int nbNodes = umesh->getNumberOfNodes();
+ const mcIdType nbNodes = umesh->getNumberOfNodes();
*_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl
<< " PILE NUMERO 32NBRE OBJETS NOMMES 0NBRE OBJETS" << setw(8) << nbNodes << endl;
*_sauvFile << setw(8) << nbNodes << endl;
//
TFieldCounter fcount( *_sauvFile, 10 );// * 8000 FORMAT(10I8)
- for ( int i = 0; i < nbNodes; ++i, fcount++ )
+ for ( mcIdType i = 0; i < nbNodes; ++i, fcount++ )
*_sauvFile << setw(8) << i + 1;
fcount.stop();
*_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl;
*_sauvFile << " PILE NUMERO 33NBRE OBJETS NOMMES 0NBRE OBJETS 1" << endl;
//
- const int dim = umesh->getSpaceDimension();
- const int nbValues = nbNodes * ( dim + 1 );
+ const int dim = umesh->getSpaceDimension();
+ const mcIdType nbValues = nbNodes * ( dim + 1 );
*_sauvFile << setw(8) << nbValues << endl;
// * 8003 FORMAT(1P,3E22.14)
*_sauvFile << endl;
string theWholeString; // concatenated long names
- vector<int> theOffsets;
+ vector<std::size_t> theOffsets;
int iStr = 1;
TFieldCounter fcount (*_sauvFile, 10);
// Write the STRING pile
// ----------------------
- const int nbNames = theOffsets.size();
+ const std::size_t nbNames = theOffsets.size();
*_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl
<< " PILE NUMERO 27NBRE OBJETS NOMMES" << zeroI8 << "NBRE OBJETS" << setw(8) << nbNames << endl
<< setw(8) << theWholeString.length() << setw(8) << nbNames << endl;
*_sauvFile << setw(72) << theWholeString.substr(aPos, fixedLength) << endl;
// write the offsets
- for ( size_t i = 0; i < theOffsets.size(); ++i, fcount++ )
+ for ( std::size_t i = 0; i < theOffsets.size(); ++i, fcount++ )
*_sauvFile << setw(8) << theOffsets[i];
}
flds = isNodal ? _nodeFields : _cellFields;
map<string,int> nameNbMap;
- for ( size_t iF = 0; iF < flds.size(); ++iF )
+ for ( unsigned int iF = 0; iF < flds.size(); ++iF )
{
string name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 );
nameGIBItoMED aMEDName;
// (1) write nb subcomponents, nb components(total)
vector< pair<int,int> > iters = _nodeFields[iF]->getIterations();
const vector<string>& compInfo = _nodeFields[iF]->getInfo();
- const int nbSub = iters.size();
- const int nbComp = compInfo.size();
- const int totalNbComp = nbSub * nbComp;
+ const std::size_t nbSub = iters.size();
+ const std::size_t nbComp = compInfo.size();
+ const std::size_t totalNbComp = nbSub * nbComp;
*_sauvFile << setw(8) << nbSub
<< setw(8) << totalNbComp
<< setw(8) << -1 // IFOUR
<< pfls[0][0] << "|");
vals[0] = -pfl2Sub->second->_id;
vals[1] = (valsVec[0][0].second-valsVec[0][0].first);
- vals[2] = compInfo.size();
+ vals[2] = ToIdType( compInfo.size() );
for ( size_t i = 0; i < vals.size(); ++i, fcount++ )
*_sauvFile << setw(8) << vals[i];
}
// (10) 1.00000000000000E+02 1.00000000000000E+02 1.00000000000000E+02
// (10) ...
- for ( size_t iF = 0; iF < _cellFields.size(); ++iF )
+ for ( unsigned int iF = 0; iF < _cellFields.size(); ++iF )
{
// count nb of sub-components
- int iSub, nbSub = 0;
+ std::size_t iSub, nbSub = 0;
vector< pair<int,int> > iters = _cellFields[iF]->getIterations();
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
*_sauvFile << setw(72) << " " << endl;
// (3) support, nb components
- vector<int> vals(9, 0);
+ vector<mcIdType> vals(9, 0);
const vector<string>& compInfo = _cellFields[iF]->getInfo();
- vals[2] = compInfo.size();
+ vals[2] = ToIdType( compInfo.size() );
fcount.init(10);
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
const vector<string>& compInfo = _cellFields[iF]->getInfo();
// (6) component addresses
- int iComp = 0, nbComp = compInfo.size();
+ std::size_t iComp = 0, nbComp = compInfo.size();
for ( fcount.init(10); iComp < nbComp; ++iComp, fcount++ )
*_sauvFile << setw(8) << 777; // a good number
fcount.stop();
*/
struct SubMesh
{
- std::vector<int> _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ];
+ std::vector<mcIdType> _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ];
std::vector<SubMesh*> _subs;
std::string _name;
int _id;
def MEDCouplingDataArrayFloatIdiv(self,*args):
import _MEDLoader
return _MEDLoader.DataArrayFloat____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntIadd(self,*args):
+def MEDCouplingDataArrayInt32Iadd(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntIsub(self,*args):
+ return _MEDLoader.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____isub___(self, self, *args)
-def MEDCouplingDataArrayIntImul(self,*args):
+ return _MEDLoader.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____imul___(self, self, *args)
-def MEDCouplingDataArrayIntIdiv(self,*args):
+ return _MEDLoader.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntImod(self,*args):
+ return _MEDLoader.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____imod___(self, self, *args)
-def MEDCouplingDataArrayIntIpow(self,*args):
+ return _MEDLoader.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayInt____ipow___(self, self, *args)
+ return _MEDLoader.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
import _MEDLoader
return _MEDLoader.DataArrayDoubleTuple____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _MEDLoader
return _MEDLoader.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
+ import _MEDLoader
+ return _MEDLoader.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _MEDLoader.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
import _MEDLoader
- return _MEDLoader.DataArrayIntTuple____imod___(self, self, *args)
+ return _MEDLoader.DataArrayInt64Tuple____imod___(self, self, *args)
def MEDCouplingDenseMatrixIadd(self,*args):
import _MEDLoader
return _MEDLoader.DenseMatrix____iadd___(self, self, *args)
PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName);
- int size=v.size();
+ std::size_t size=v.size();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
return ret;
}
for(int j=0;j<(int)ret1.size()/3;j++)
{
PyObject *retLev2=PyList_New(3);
- PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
- PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
- PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
+ PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j]));
+ PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1]));
+ PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2]));
PyList_SetItem(retLev1_0,j,retLev2);
}
PyTuple_SetItem(ret,1,retLev1_0);
for(int j=0;j<(int)ret2.size()/3;j++)
{
PyObject *retLev2=PyList_New(3);
- PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
- PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
- PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
+ PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j]));
+ PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1]));
+ PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2]));
PyList_SetItem(retLev1_1,j,retLev2);
}
PyTuple_SetItem(ret,2,retLev1_1);
PyObject *ret(PyTuple_New(5));
PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
- int sz(a2.size());
+ std::size_t sz(a2.size());
PyObject *ret2(PyList_New(sz));
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
PyTuple_SetItem(ret,2,ret2);
sz=a3.size();
PyObject *ret3(PyList_New(sz));
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
DataArrayIdType *elt(a3[i]);
if(elt)
static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception(MSG);
- int sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=5)
throw INTERP_KERNEL::Exception(MSG);
std::vector<double> a0;
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
- PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
+ PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
PyTuple_SetItem(elt3,1,elt4);
PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
const std::vector<DataArrayDouble *>& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
{
if(elt0 && PyInt_Check(elt0))
{//fmts[3]
- int pos=PyInt_AS_LONG(elt0);
+ int pos=(int)PyInt_AS_LONG(elt0);
return pos;
}
else if(elt0 && PyTuple_Check(elt0))
PyObject *o1=PyTuple_GetItem(elt0,1);
if(PyInt_Check(o0) && PyInt_Check(o1))
{//fmts(1,-1)
- int iter=PyInt_AS_LONG(o0);
- int order=PyInt_AS_LONG(o1);
+ int iter=(int)PyInt_AS_LONG(o0);
+ int order=(int)PyInt_AS_LONG(o1);
return self->getPosOfTimeStep(iter,order);
}
else
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
- PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
+ PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,PyInt_FromLong(dadsI[j].first)); PyTuple_SetItem(elt4,1,PyInt_FromLong(dadsI[j].second));
PyTuple_SetItem(elt3,1,elt4);
PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
{
if(PyList_Check(elts))
{
- int sz=PyList_Size(elts);
+ std::size_t sz=PyList_Size(elts);
std::vector<int> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *elt=PyList_GetItem(elts,i);
ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
- self->eraseTimeStepIds2(strt,stp,step);
+ self->eraseTimeStepIds2((int)strt,(int)stp,(int)step);
}
else
{
{
if(elt0 && PyList_Check(elt0))
{
- int sz=PyList_Size(elt0);
+ std::size_t sz=PyList_Size(elt0);
MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
int *pt=da->getPointer();
- for(int i=0;i<sz;i++,pt++)
+ for(std::size_t i=0;i<sz;i++,pt++)
{
PyObject *elt1=PyList_GetItem(elt0,i);
*pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
- return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
+ return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0);
}
else
return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
- int sz=ret.size();
+ std::size_t sz=ret.size();
PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
const std::vector<DataArrayDouble *>& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& locsI=locs[i];
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
+ std::size_t sz2=ret[i].size();
PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
+ for(std::size_t j=0;j<sz2;j++)
{
PyObject *elt3=PyTuple_New(4);
PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
PyObject *elt3=PyTuple_New(2);
- PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
- PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
+ PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
+ PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
PyTuple_SetItem(elt1,0,elt2);
PyTuple_SetItem(elt1,1,elt3);
PyList_SetItem(elt,i,elt1);
{
if(obj && PyList_Check(obj))
{
- int sz=PyList_Size(obj);
+ std::size_t sz=PyList_Size(obj);
MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
int *pt=da->getPointer();
- for(int i=0;i<sz;i++,pt++)
+ for(std::size_t i=0;i<sz;i++,pt++)
{
PyObject *elt1=PyList_GetItem(obj,i);
*pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
throw INTERP_KERNEL::Exception(msg);
if(PyInt_Check(elt0))
{//fmts[3]
- return PyInt_AS_LONG(elt0);
+ return (int)PyInt_AS_LONG(elt0);
}
return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
}
{
if(PyList_Check(elts))
{
- int sz=PyList_Size(elts);
+ std::size_t sz=PyList_Size(elts);
std::vector<int> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *elt=PyList_GetItem(elts,i);
ret[i]=MEDCoupling_MEDFileFields_getPosOfField(self,elt);
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
- self->destroyFieldsAtPos2(strt,stp,step);
+ self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step);
}
else
{
PyObject *o1=PyTuple_GetItem(elt0,1);
if(PyInt_Check(o0) && PyInt_Check(o1))
{//fmts(1,-1)
- int iter=PyInt_AS_LONG(o0);
- int order=PyInt_AS_LONG(o1);
+ int iter=(int)PyInt_AS_LONG(o0);
+ int order=(int)PyInt_AS_LONG(o1);
return self->getPosOfTimeStep(iter,order);
}
else
{
if(PyList_Check(elts))
{
- int sz=PyList_Size(elts);
+ std::size_t sz=PyList_Size(elts);
std::vector<int> ret(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *elt=PyList_GetItem(elts,i);
ret[i]=MEDCoupling_MEDFileParameterMultiTS_getTimeStepId(self,elt);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
PyObject *ret1Py=PyList_New(sz);
for(std::size_t i=0;i<sz;i++)
- PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
+ PyList_SetItem(ret1Py,i,PyInt_FromLong(ret1[i]));
PyTuple_SetItem(ret,1,ret1Py);
PyObject *ret2Py(ret2?Py_True:Py_False);
Py_XINCREF(ret2Py);
self.assertTrue(a.getArray().isEqual(2*f1.getArray()))
f1.setTime(3.,1,2) ; f1.getArray()[:]*=2
self.assertTrue(a.isEqual(f1,1e-12,0)) ; f1.getArray()[:]/=2
- bc=DataArrayInt(6,3) ; bc[:]=0 ; bc.setInfoOnComponents(['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
+ bc=DataArrayInt32(6,3) ; bc[:]=0 ; bc.setInfoOnComponents(['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
for it in ffs1:
a=it.getFieldOnMeshAtLevel(ON_CELLS,0,mm1)
bc+=a.getArray()
nf1=MEDCouplingFieldInt(ON_NODES)
nf1.setTime(9.,10,-1)
nf1.setMesh(f1.getMesh())
- narr=DataArrayInt(12,2) ; narr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; narr[:,0]=list(range(12)) ; narr[:,1]=2*narr[:,0]
+ narr=DataArrayInt32(12,2) ; narr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; narr[:,0]=list(range(12)) ; narr[:,1]=2*narr[:,0]
nf1.setName("VectorFieldOnNodes") ; nf1.setArray(narr)
nff1=MEDFileIntField1TS.New()
nff1.setFieldNoProfileSBT(nf1)
nf2=MEDCouplingFieldInt(ON_NODES)
nf2.setTime(19.,20,-11)
nf2.setMesh(f1.getMesh())
- narr2=DataArrayInt(8,2) ; narr.setInfoOnComponents(["aapfl [u1]","bbbvvpfl [ppp]"]) ; narr2[:,0]=list(range(8)) ; narr2[:,0]+=10 ; narr2[:,1]=3*narr2[:,0]
+ narr2=DataArrayInt32(8,2) ; narr.setInfoOnComponents(["aapfl [u1]","bbbvvpfl [ppp]"]) ; narr2[:,0]=list(range(8)) ; narr2[:,0]+=10 ; narr2[:,1]=3*narr2[:,0]
nf2.setName("VectorFieldOnNodesPfl") ; narr2.setName(nf2.getName()) ; nf2.setArray(narr2)
nff2=MEDFileIntField1TS.New()
npfl=DataArrayInt([1,2,4,5,6,7,10,11]) ; npfl.setName("npfl")
for delt,(dt,it,t) in zip([0,100,200],ff1.getTimeSteps()):
self.assertEqual(ff1.getFieldSplitedByType(dt,it),fspExp)
arr=ff1.getUndergroundDataArray(dt,it)
- arr.isEqualWithoutConsideringStr(DataArrayInt.Range(delt,delt+7,1))
+ arr.isEqualWithoutConsideringStr(DataArrayInt32.Range(delt,delt+7,1))
pass
self.assertEqual(ff1.getPfls(),('pfl_NORM_QUAD4', 'pfl_NORM_QUAD4', 'pfl_NORM_QUAD4'))
#
for delt,(dt,it,t) in zip([0,100,200],ff1.getTimeSteps()):
self.assertTrue(ff1.getFieldSplitedByType(dt,it),fspExp)
arr=ff1.getUndergroundDataArray(dt,it)
- arr.isEqualWithoutConsideringStr(DataArrayInt.Range(delt,delt+7,1))
+ arr.isEqualWithoutConsideringStr(DataArrayInt32.Range(delt,delt+7,1))
pass
self.assertEqual(ff1.getPfls(),('pfl_NORM_QUAD4',))
pass
eqs=mm.getEquivalences()
eq0=eqs.appendEmptyEquivalenceWithName(eqName)
eq0.setDescription(descEq)
- corr=DataArrayInt([(0,3),(0,4),(0,5),(0,6),(1,7),(1,8),(1,9),(1,10),(2,11),(2,12),(2,13),(2,14)])
+ corr=DataArrayInt32([(0,3),(0,4),(0,5),(0,6),(1,7),(1,8),(1,9),(1,10),(2,11),(2,12),(2,13),(2,14)])
eq0.setArray(-1,corr)
self.assertEqual(eq0.getCell().size(),1)
self.assertTrue(eq0.getCell().getArray(NORM_QUAD4).isEqual(corr))
f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(mesh)
fieldName="FieldOnCell"
f.setTime(1.2,1,1) ; f.setName(fieldName)
- arr=DataArrayInt([101,102,103]) ; f.setArray(arr)
+ arr=DataArrayInt32([101,102,103]) ; f.setArray(arr)
fmts.appendFieldProfile(f,mm,0,pfl)
#
mm.write(fname,2)
m.insertNextCell(NORM_QUAD4,[104,105,106,107])
mm[0]=m
mm.write(fname,2)
- arr0=DataArrayInt([10,11,12,13,100,101])
+ arr0=DataArrayInt32([10,11,12,13,100,101])
f=MEDCouplingFieldInt(ON_CELLS) ; f.setArray(arr0) ; f.setMesh(m)
f.setName(fieldName) ; f.setTime(2.,6,7)
f0=f.deepCopy()
fmts=MEDFileIntFieldMultiTS(fname,fieldName)
self.assertTrue(f1.isEqual(fmts.field(8,9,mm),1e-12,0))
## Basic test on nodes on top level
- f2=MEDCouplingFieldInt(ON_NODES) ; arr2=DataArrayInt([200,201,202]) ; arr2.setInfoOnComponent(0,"tutu") ; f2.setArray(arr2) ; f2.setMesh(m) ; f2.setTime(22.,23,24)
+ f2=MEDCouplingFieldInt(ON_NODES) ; arr2=DataArrayInt32([200,201,202]) ; arr2.setInfoOnComponent(0,"tutu") ; f2.setArray(arr2) ; f2.setMesh(m) ; f2.setTime(22.,23,24)
f2.setName(fieldName)
mm.write(fname,2)
ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f2) ; ff.write(fname,0)
fmts=MEDFileIntFieldMultiTS(fname,fieldName)
self.assertTrue(f2.isEqual(fmts.field(23,24,mm),1e-12,0))
## Node on elements
- f3=MEDCouplingFieldInt(ON_GAUSS_NE) ; f3.setMesh(m) ; arr3=DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
+ f3=MEDCouplingFieldInt(ON_GAUSS_NE) ; f3.setMesh(m) ; arr3=DataArrayInt32([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
f3.setName(fieldName) ; f3.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f3) ; ff.write(fname,0)
#
f4=MEDCouplingFieldInt(ON_GAUSS_PT) ; f4.setMesh(m) ; f4.setName(fieldName)
f4.setGaussLocalizationOnType(NORM_TRI3,[0.,0.,1.,0.,1.,1.],[0.1,0.1, 0.2,0.2, 0.3,0.3, 0.4,0.4, 0.5,0.5],[0.2,0.3,0.1,0.05,0.35])
f4.setGaussLocalizationOnType(NORM_QUAD4,[0.,0.,1.,0.,1.,1.,0.,1.],[0.3,0.4, 0.6,0.7],[0.7,0.3]) ; f4.setTime(0.25,4,5)
- arr4=DataArrayInt([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
+ arr4=DataArrayInt32([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
f4.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f4) ; ff.write(fname,0)
#
mm[0]=m0
mm.write(fname,2)
# start slowly
- f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt([(0,100),(1,101)])) ; f1.setMesh(mm[0]) ; f1.setTime(4.,1,2)
+ f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt32([(0,100),(1,101)])) ; f1.setMesh(mm[0]) ; f1.setTime(4.,1,2)
f1ts=MEDFileIntField1TS() ; f1ts.setFieldNoProfileSBT(f1) ; f1ts.write(fname,0)
#
mm=MEDFileMesh.New(fname) ; f1ts=MEDFileIntField1TS(fname,fieldName,1,2)
self.assertTrue(f1.isEqual(f1ts.field(mm),1e-12,0))
# here f1 lying on level -1 not 0 check if "field" method detect it !
- f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt([(0,100),(1,101),(0,100),(1,101),(0,100),(1,101)]))
+ f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setName(fieldName) ; f1.setArray(DataArrayInt32([(0,100),(1,101),(0,100),(1,101),(0,100),(1,101)]))
f1.setMesh(mm[-1]) # -1 is very important
f1.setTime(16.,3,4)
f1.checkConsistencyLight()
# nodes on elements
f3=MEDCouplingFieldInt(ON_GAUSS_NE)
f3.setMesh(mm[-1]) # this line is important
- arr3=DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
+ arr3=DataArrayInt32([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; f3.setArray(arr3) ; f3.setTime(0.5,2,3)
f3.setName(fieldName) ; f3.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f3) ; ff.write(fname,0)
#
f4.setName(fieldName)
f4.setGaussLocalizationOnType(NORM_TRI3,[0.,0.,1.,0.,1.,1.],[0.1,0.1, 0.2,0.2, 0.3,0.3, 0.4,0.4, 0.5,0.5],[0.2,0.3,0.1,0.05,0.35])
f4.setGaussLocalizationOnType(NORM_QUAD4,[0.,0.,1.,0.,1.,1.,0.,1.],[0.3,0.4, 0.6,0.7],[0.7,0.3]) ; f4.setTime(0.25,4,5)
- arr4=DataArrayInt([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
+ arr4=DataArrayInt32([0,1,2,3,4 ,10,11,12,13,14, 20,21,22,23,24, 30,31,32,33,34, 45,46, 55,56]) ; arr4.setInfoOnComponent(0,"abc") ; f4.setArray(arr4)
f4.checkConsistencyLight()
mm.write(fname,2) ; ff=MEDFileIntField1TS() ; ff.setFieldNoProfileSBT(f4) ; ff.write(fname,0)
mm=MEDFileMesh.New(fname) ; f1ts=MEDFileIntField1TS(fname,fieldName,4,5)
std::vector<std::pair<int,int> > ret;
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
std::pair<int,int> p;
- int size2=PyTuple_Size(o);
+ std::size_t size2=PyTuple_Size(o);
if(size2!=2)
throw INTERP_KERNEL::Exception("tuples in list must be of size 2 (dt,it) !");
PyObject *o0=PyTuple_GetItem(o,0);
static const char msg2[]="Unrecognized python argument : expected a list of string or tuple of string or string !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
v.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
v[i]=convertPyObjectToStr(o,msg0);
}
else if(PyTuple_Check(pyLi))
{
- int size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
v.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
v[i]=convertPyObjectToStr(o,msg1);
static PyObject *convertFieldDoubleVecToPy(const std::vector<MEDCoupling::MEDCouplingFieldDouble *>& li)
{
- int sz=li.size();
+ std::size_t sz=li.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *o=SWIG_NewPointerObj((void*)li[i],SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,SWIG_POINTER_OWN | 0);
PyList_SetItem(ret,i,o);
return ret;
}
-PyObject *convertVecPairIntToPy(const std::vector< std::pair<int,int> >& vec)
+template< class T >
+PyObject *convertVecPairIntToPy(const std::vector< std::pair<int,T> >& vec)
{
PyObject *ret(PyList_New(vec.size()));
int rk=0;
- for(std::vector< std::pair<int,int> >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++)
+ for(typename std::vector< std::pair<int,T> >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++)
{
PyObject *elt=PyTuple_New(2);
PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
- PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+ PyTuple_SetItem(elt,1,PyInt_FromLong((*iter).second));
PyList_SetItem(ret,rk,elt);
}
return ret;
PyObject *convertVecPairVecStToPy(const std::vector< std::pair<std::vector<std::string>, std::string > >& vec)
{
- int sz=(int)vec.size();
+ std::size_t sz=vec.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *t=PyTuple_New(2);
int sz2=(int)vec[i].first.size();
PyObject *convertVectPairStToPy(const std::vector< std::pair<std::string, std::string > >& vec)
{
- int sz=(int)vec.size();
+ std::size_t sz=vec.size();
PyObject *ret=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
PyObject *t=PyTuple_New(2);
PyTuple_SetItem(t,0,PyString_FromString(vec[i].first.c_str()));
const char *msg="convertVecPairStStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is one string and the 2nd one a string !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
std::pair<std::string, std::string> p;
- int size2=PyTuple_Size(o);
+ std::size_t size2=PyTuple_Size(o);
if(size2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o0=PyTuple_GetItem(o,0);
const char *msg="convertVecPairVecStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is a list of strings and the 2nd one a string !";
if(PyList_Check(pyLi))
{
- int size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(int i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
std::pair<std::vector<std::string>, std::string> p;
- int size2=PyTuple_Size(o);
+ std::size_t size2=PyTuple_Size(o);
if(size2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o0=PyTuple_GetItem(o,0);
if(PyList_Check(o0))
{
- int size3=PyList_Size(o0);
+ std::size_t size3=PyList_Size(o0);
p.first.resize(size3);
- for(int j=0;j<size3;j++)
+ for(std::size_t j=0;j<size3;j++)
{
PyObject *o0j=PyList_GetItem(o0,j);
p.first[j]=convertPyObjectToStr(o0j,msg);
PyObject *o1=PyTuple_GetItem(elt0,1);
if(PyInt_Check(o0) && PyInt_Check(o1))
{//fmts(1,-1)
- int iter=PyInt_AS_LONG(o0);
- int order=PyInt_AS_LONG(o1);
+ int iter=(int)PyInt_AS_LONG(o0);
+ int order=(int)PyInt_AS_LONG(o1);
return self->getPosOfTimeStep(iter,order);
}
else
static const char msg[]="MEDFileFields::__getitem__ : only integer or string with fieldname supported !";
if(PyInt_Check(obj))
{
- return InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfFields());
+ return InterpreteNegativeInt(PyInt_AS_LONG(obj),self->getNumberOfFields());
}
return self->getPosFromFieldName(convertPyObjectToStr(obj,msg));
}
-void convertToMapIntDataArrayInt(PyObject *pyMap, std::map<int, MCAuto<DataArrayInt> >& cppMap)
+void convertToMapIntDataArrayInt(PyObject *pyMap, std::map<int, MCAuto<DataArrayIdType> >& cppMap)
{
if(!PyDict_Check(pyMap))
throw INTERP_KERNEL::Exception("convertToMapIntDataArrayInt : input is not a python map !");
{
if(!PyInt_Check(key))
throw INTERP_KERNEL::Exception("convertToMapIntDataArrayInt : keys in map must be PyInt !");
- long k(PyInt_AS_LONG(key));
+ int k((int)PyInt_AS_LONG(key));
void *argp(0);
- int status(SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
+ int status(SWIG_ConvertPtr(value,&argp,SWIGTITraits<mcIdType>::TI,0|0));
if(!SWIG_IsOK(status))
{
std::ostringstream oss; oss << "convertToMapIntDataArrayInt : values in map must be DataArrayInt !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- DataArrayInt *arg(reinterpret_cast<DataArrayInt*>(argp));
- MCAuto<DataArrayInt> arg2(arg);
+ DataArrayIdType *arg(reinterpret_cast<DataArrayIdType*>(argp));
+ MCAuto<DataArrayIdType> arg2(arg);
if(arg)
arg->incrRef();
cppMap[k]=arg2;
template<class T>
PyObject *MEDFileField1TS_getFieldWithProfile(const typename MLFieldTraits<T>::F1TSType *self, TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh)
{
- DataArrayInt *ret1(NULL);
+ DataArrayIdType *ret1(NULL);
typename MEDCoupling::Traits<T>::ArrayType *ret0(self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1));
PyObject *ret(PyTuple_New(2));
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<T>::TI, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
template<class T>
PyObject *MEDFileField1TS_getUndergroundDataArrayExt(const typename MLFieldTraits<T>::F1TSType *self)
{
- std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
+ std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
typename MEDCoupling::Traits<T>::ArrayType *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
if(elt0)
elt0->incrRef();
PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
PyObject *elt3=PyTuple_New(2);
- PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
- PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
+ PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first));
+ PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second));
PyTuple_SetItem(elt1,0,elt2);
PyTuple_SetItem(elt1,1,elt3);
PyList_SetItem(elt,i,elt1);
ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${LIBXML2_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
INCLUDE_DIRECTORIES(
${LIBXML2_INCLUDE_DIR}
${MEDFILE_INCLUDE_DIRS}
MEDPARTITIONER::ConnectZone::~ConnectZone()
{
- for(std::map < std::pair <int, int>,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++)
+ for(std::map < std::pair <mcIdType, mcIdType>,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++)
{
iter->second->decrRef();
}
return _distant_mesh;
}
-bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(int localEntity, int distantEntity) const
+bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(mcIdType localEntity, mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for(map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
if ((iter->first).first==localEntity && (iter->first).second==distantEntity)
return _face_corresp;
}
-const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity,
- int distantEntity) const
+const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
return 0;
}
-const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity,
- int distantEntity) const
+const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for (map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
return 0;
}
-mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity,
- int distantEntity) const
+mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++)
{
return 0;
}
-mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity,
- int distantEntity) const
+mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(mcIdType localEntity,
+ mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
}
const MEDCouplingSkyLineArray *
-MEDPARTITIONER::ConnectZone::getEntityCorresp(int localEntity, int distantEntity) const
+MEDPARTITIONER::ConnectZone::getEntityCorresp(mcIdType localEntity, mcIdType distantEntity) const
{
- typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
+ typedef std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++)
{
return 0;
}
-std::vector< std::pair< int,int > > MEDPARTITIONER::ConnectZone::getEntities() const
+std::vector< std::pair< mcIdType,mcIdType > > MEDPARTITIONER::ConnectZone::getEntities() const
{
- std::vector< std::pair< int,int > > types;
+ std::vector< std::pair< mcIdType,mcIdType > > types;
- std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator
+ std::map<std::pair<mcIdType,mcIdType>, MEDCouplingSkyLineArray*>::const_iterator
iter = _entity_corresp.begin();
for ( ; iter != _entity_corresp.end(); iter++)
{
MEDCouplingSkyLineArray *array)
{
MEDCouplingSkyLineArray * nullArray = 0;
- std::map < std::pair <int,int>, MEDCouplingSkyLineArray * >::iterator it;
+ std::map < std::pair <mcIdType,mcIdType>, MEDCouplingSkyLineArray * >::iterator it;
it = _entity_corresp.insert
( std::make_pair( std::make_pair(localEntity,distantEntity), nullArray )).first;
if ( it->second != nullArray ) it->second->decrRef();
MEDCouplingUMesh *getLocalMesh() const ;
MEDCouplingUMesh *getDistantMesh() const ;
- bool isEntityCorrespPresent(int localEntity,int distantEntity) const;
+ bool isEntityCorrespPresent(mcIdType localEntity,mcIdType distantEntity) const;
const mcIdType *getNodeCorrespIndex() const;
const mcIdType *getNodeCorrespValue() const;
mcIdType getNodeNumber() const;
const mcIdType *getFaceCorrespValue() const;
mcIdType getFaceNumber() const;
const MEDCouplingSkyLineArray * getFaceCorresp() const;
- const mcIdType *getEntityCorrespIndex(int localEntity,
- int distantEntity) const;
- const mcIdType *getEntityCorrespValue(int localEntity,
- int distantEntity) const;
- mcIdType getEntityCorrespNumber(int localEntity,
- int distantEntity) const;
- mcIdType getEntityCorrespLength(int localEntity,
- int distantEntity) const;
- const MEDCouplingSkyLineArray * getEntityCorresp(int localEntity,
- int distantEntity) const;
- std::vector< std::pair< int,int > > getEntities() const;
+ const mcIdType *getEntityCorrespIndex(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ const mcIdType *getEntityCorrespValue(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ mcIdType getEntityCorrespNumber(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ mcIdType getEntityCorrespLength(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ const MEDCouplingSkyLineArray * getEntityCorresp(mcIdType localEntity,
+ mcIdType distantEntity) const;
+ std::vector< std::pair< mcIdType,mcIdType > > getEntities() const;
void setName(const std::string& name) ;
void setDescription(const std::string& description) ;
MCAuto<MEDCouplingSkyLineArray> _node_corresp;
MCAuto<MEDCouplingSkyLineArray> _face_corresp;
- std::map < std::pair <int,int>, MEDCouplingSkyLineArray * > _entity_corresp;
+ std::map < std::pair <mcIdType,mcIdType>, MEDCouplingSkyLineArray * > _entity_corresp;
};
}
# endif
for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom )
domains.insert( *dom );
}
- return domains.size();
+ return (int)domains.size();
}
const mcIdType *Graph::getPart() const
int nbproc=_domain_selector->nbProcs();
std::vector<BBTreeOfDim* > bbtree(nbdomain,(BBTreeOfDim*) 0);
std::vector<double* > bbxi(nbdomain,(double*) 0);
- std::vector<MEDCoupling::DataArrayInt*> rev(nbdomain,(MEDCoupling::DataArrayInt*) 0);
- std::vector<MEDCoupling::DataArrayInt*> revIndx(nbdomain,(MEDCoupling::DataArrayInt*) 0);
- int meshDim=-1;
+ std::vector<MEDCoupling::DataArrayIdType*> rev(nbdomain,(MEDCoupling::DataArrayIdType*) 0);
+ std::vector<MEDCoupling::DataArrayIdType*> revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) 0);
+ //int meshDim=-1;
int spaceDim=-1;
//init rev and revIndx and bbtree for my domain (of me:proc n)
if(!_domain_selector->isMyDomain(mydomain))
continue;
const MEDCoupling::MEDCouplingUMesh* myMesh=_mesh_collection.getMesh(mydomain);
- meshDim = myMesh->getMeshDimension();
+ //meshDim = myMesh->getMeshDimension();
spaceDim= myMesh->getSpaceDimension();
- rev[mydomain] = MEDCoupling::DataArrayInt::New();
- revIndx[mydomain] = MEDCoupling::DataArrayInt::New();
+ rev[mydomain] = MEDCoupling::DataArrayIdType::New();
+ revIndx[mydomain] = MEDCoupling::DataArrayIdType::New();
myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]);
double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()];
for (int i=0; i<myMesh->getNumberOfNodes()*spaceDim; i++)
SendDoubleVec(vec,targetProc);
//retrieving target data for storage in commonDistantNodes array
- std::vector<int> localCorrespondency;
+ std::vector<mcIdType> localCorrespondency;
RecvIntVec(localCorrespondency, targetProc);
for (std::size_t i=0; i<localCorrespondency.size()/2; i++)
{
int sourceProc = isource%nbproc;
std::vector<double> recvVec;
RecvDoubleVec(recvVec,sourceProc);
- std::map<int,int> commonNodes; // (local nodes, distant nodes) list
- for (int inode=0; inode<(recvVec.size()/spaceDim); inode++)
+ std::map<mcIdType,mcIdType> commonNodes; // (local nodes, distant nodes) list
+ for (mcIdType inode=0; inode<ToIdType(recvVec.size()/spaceDim); inode++)
{
double* bbox=new double[2*spaceDim];
for (int i=0; i<spaceDim; i++)
bbox[2*i]=recvVec[inode*spaceDim+i]-1e-12;
bbox[2*i+1]=bbox[2*i]+2e-12;
}
- std::vector<int> inodes;
+ std::vector<mcIdType> inodes;
bbtree[itarget]->getIntersectingElems(bbox,inodes);
delete [] bbox;
}
}
- std::vector<int> nodeCellCorrespondency;
- for (std::map<int,int>::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++)
+ std::vector<mcIdType> nodeCellCorrespondency;
+ for (std::map<mcIdType,mcIdType>::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++)
{
_node_node[itarget][isource].push_back(std::make_pair(iter->first, iter->second));//storing node pairs in a vector
- const int* revIndxPtr=revIndx[itarget]->getConstPointer();
- const int* revPtr=rev[itarget]->getConstPointer();
- for (int icell=revIndxPtr[iter->first]; icell<revIndxPtr[iter->first+1]; icell++)
+ const mcIdType* revIndxPtr=revIndx[itarget]->getConstPointer();
+ const mcIdType* revPtr=rev[itarget]->getConstPointer();
+ for (mcIdType icell=revIndxPtr[iter->first]; icell<revIndxPtr[iter->first+1]; icell++)
{
nodeCellCorrespondency.push_back(iter->second); //
- int globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]);
+ mcIdType globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]);
nodeCellCorrespondency.push_back(globalCell);
}
}
std::cout << "proc " << _domain_selector->rank() << " : end JointFinder::findCommonDistantNodes" << std::endl;
}
-std::vector<std::vector<std::multimap<int,int> > >& MEDPARTITIONER::JointFinder::getDistantNodeCell()
+std::vector<std::vector<std::multimap<mcIdType,mcIdType> > >& MEDPARTITIONER::JointFinder::getDistantNodeCell()
{
return _distant_node_cell;
}
-std::vector<std::vector<std::vector<std::pair<int,int> > > >& MEDPARTITIONER::JointFinder::getNodeNode()
+std::vector<std::vector<std::vector<std::pair<mcIdType,mcIdType> > > >& MEDPARTITIONER::JointFinder::getNodeNode()
{
return _node_node;
}
{
for (int itarget=0; itarget<nbdomain; itarget++)
{
- std::multimap<int,int>::iterator it;
+ std::multimap<mcIdType,mcIdType>::iterator it;
for (it=_distant_node_cell[isource][itarget].begin() ; it!=_distant_node_cell[isource][itarget].end(); it++)
{
std::cout << " nc" << _domain_selector->rank() << "|" << itarget << "|" << isource << "|" << (*it).first << "=" << (*it).second;
#define __MEDPARTITIONER_JOINTFINDER_HXX__
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <map>
#include <vector>
~JointFinder();
void findCommonDistantNodes();
void print();
- std::vector<std::vector<std::multimap<int,int> > >& getDistantNodeCell();
- std::vector<std::vector<std::vector<std::pair<int,int> > > >& getNodeNode();
+ std::vector<std::vector<std::multimap<mcIdType,mcIdType> > >& getDistantNodeCell();
+ std::vector<std::vector<std::vector<std::pair<mcIdType,mcIdType> > > >& getNodeNode();
private:
const MeshCollection& _mesh_collection;
const ParaDomainSelector *_domain_selector;
const Topology *_topology;
- std::vector<std::vector<std::multimap<int,int> > > _distant_node_cell;
- std::vector<std::vector<std::vector<std::pair<int,int> > > > _node_node;
+ std::vector<std::vector<std::multimap<mcIdType,mcIdType> > > _distant_node_cell;
+ std::vector<std::vector<std::vector<std::pair<mcIdType,mcIdType> > > > _node_node;
};
}
castAllFields(initialCollection,"cellFieldDouble");
if (_i_non_empty_mesh<0)
{
- for (size_t i=0; i<_mesh.size(); i++)
+ for (int i=0; i<getNbOfGlobalMeshes(); i++)
{
if (_mesh[i])
{
{
if (!isParallelMode() || initialCollection._domain_selector->isMyDomain(iold))
{
- int size=(initialCollection._mesh)[iold]->getNumberOfCells();
- std::vector<int> globalids(size);
+ mcIdType size=(initialCollection._mesh)[iold]->getNumberOfCells();
+ std::vector<mcIdType> globalids(size);
initialCollection.getTopology()->getCellList(iold, &globalids[0]);
- std::vector<int> ilocalnew(size); //local
+ std::vector<mcIdType> ilocalnew(size); //local
std::vector<int> ipnew(size); //idomain old
_topology->convertGlobalCellList(&globalids[0],size,&ilocalnew[0],&ipnew[0]);
// std::map<pair<double,pair<double, double> >, int > nodeClassifier;
MEDCoupling::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords();
double* coordsPtr=coords->getPointer();
- dim = coords->getNumberOfComponents();
- int nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
+ dim = (int)coords->getNumberOfComponents();
+ mcIdType nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
bbox=new double[nvertices*2*dim];
for (int i=0; i<nvertices*dim;i++)
for (int inode=0; inode<mesh->getNumberOfNodes();inode++)
{
double* coordsPtr=coords->getPointer()+inode*dim;
- vector<int> elems;
+ vector<mcIdType> elems;
tree->getElementsAroundPoint(coordsPtr,elems);
if (elems.size()==0) continue;
nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode)));
for (int inode=0; inode<_mesh[inew]->getNumberOfNodes();inode++)
{
double* coordsPtr=coords->getPointer()+inode*dim;
- vector<int> elems;
+ vector<mcIdType> elems;
tree->getElementsAroundPoint(coordsPtr,elems);
if (elems.size()==0) continue;
nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode)));
}
-void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector<int>& nodeIds)
+void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector<mcIdType>& nodeIds)
{
using std::vector;
using MEDPARTITIONER::BBTreeOfDim;
//if (!&meshOne || !&meshTwo) return; //empty or not existing
double* bbox;
BBTreeOfDim* tree = 0;
- int nv1=meshOne.getNumberOfNodes();
+ mcIdType nv1=meshOne.getNumberOfNodes();
MEDCoupling::DataArrayDouble* coords=meshOne.getCoords();
- int dim = coords->getNumberOfComponents();
+ int dim = (int)coords->getNumberOfComponents();
bbox=new double[nv1*2*dim];
double* coordsPtr=coords->getPointer();
}
tree=new BBTreeOfDim( dim, bbox,0,0,nv1,1e-9);
- int nv2=meshTwo.getNumberOfNodes();
+ mcIdType nv2=meshTwo.getNumberOfNodes();
nodeIds.resize(nv2,-1);
coords=meshTwo.getCoords();
for (int inode=0; inode<nv2; inode++)
{
double* coordsPtr2=coords->getPointer()+inode*dim;
- vector<int> elems;
+ vector<mcIdType> elems;
tree->getElementsAroundPoint(coordsPtr2,elems);
if (elems.size()==0) continue;
nodeIds[inode]=elems[0];
faces at the interface are duplicated
*/
void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialCollection,
- const std::multimap<std::pair<int,int>, std::pair<int,int> >& nodeMapping,
+ const std::multimap<std::pair<int,mcIdType>, std::pair<int,mcIdType> >& nodeMapping,
std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds)
{
//splitMeshes structure will contain the partition of
//initial face mesh known : in my domain
if (meshesCastFrom[iold] != 0)
{
- for (int ielem=0; ielem<meshesCastFrom[iold]->getNumberOfCells(); ielem++)
+ for (mcIdType ielem=0; ielem<meshesCastFrom[iold]->getNumberOfCells(); ielem++)
{
vector<mcIdType> nodes;
meshesCastFrom[iold]->getNodeIdsOfCell(ielem,nodes);
- map <int,int> faces;
+ map <int,mcIdType> faces;
//analysis of element ielem
//counters are set for the element
//are incremented for each target node
//the face is considered as going to target domains if the counter of the domain
//is equal to the number of nodes
- for (int inode=0; inode<(int)nodes.size(); inode++)
+ for (std::size_t inode=0; inode<nodes.size(); inode++)
{
- typedef multimap<pair<int,int>,pair<int,int> >::const_iterator MI;
- int mynode=nodes[inode];
+ typedef multimap<pair<int,mcIdType>,pair<int,mcIdType> >::const_iterator MI;
+ mcIdType mynode=nodes[inode];
pair <MI,MI> myRange = nodeMapping.equal_range(make_pair(iold,mynode));
for (MI iter=myRange.first; iter!=myRange.second; iter++)
}
}
- for (map<int,int>::iterator iter=faces.begin(); iter!=faces.end(); iter++)
+ for (map<int,mcIdType>::iterator iter=faces.begin(); iter!=faces.end(); iter++)
{
- if (iter->second==(int)nodes.size())
+ if (iter->second==ToIdType(nodes.size()))
//cvw eligible but may be have to be face of a cell of this->getMesh()[inew]?
//it is not sure here...
//done before writeMedfile on option?... see filterFaceOnCell()
{
using std::vector;
- int ioldMax=meshesCastFrom.size();
- int inewMax=meshesCastTo.size();
+ std::size_t ioldMax=meshesCastFrom.size();
+ std::size_t inewMax=meshesCastTo.size();
//preparing bounding box trees for accelerating source-target node identifications
std::cout<<"making accelerating structures"<<std::endl;
std::vector<BBTreeOfDim* > acceleratingStructures(ioldMax);
std::vector<MEDCoupling::DataArrayDouble*>bbox(ioldMax);
- for (int iold =0; iold< ioldMax; iold++)
+ for (unsigned int iold =0; iold< ioldMax; iold++)
if (isParallelMode() && _domain_selector->isMyDomain(iold))
{
MEDCoupling::DataArrayDouble* sourceCoords=meshesCastFrom[iold]->computeCellCenterOfMass();
}
// send-recv operations
#ifdef HAVE_MPI
- for (int inew=0; inew<inewMax; inew++)
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
{
//sending arrays for distant domains
if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
//send mesh
_domain_selector->sendMesh(*meshesCastFrom[iold],_domain_selector->getProcessorID(inew));
//send vector
- int size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1!
- vector<int>sendIds;
+ mcIdType size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1!
+ vector<mcIdType> sendIds;
if (MyGlobals::_Verbose>400) std::cout<<"proc "<<_domain_selector->rank()<<" : castIntField SendIntVec size "<<size<<std::endl;
if (size>0) //no empty
{
if (isParallelMode() && !_domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
{
//receive mesh
- vector<int> recvIds;
+ vector<mcIdType> recvIds;
MEDCoupling::MEDCouplingUMesh* recvMesh;
_domain_selector->recvMesh(recvMesh,_domain_selector->getProcessorID(iold));
//receive vector
}
#endif
- //local contributions and aggregation
- for (int inew=0; inew<inewMax; inew++)
+ //localc ontributions and aggregation
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
if (!isParallelMode() || ( _domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)))
{
remapIntField(inew,iold,*meshesCastFrom[iold],*meshesCastTo[inew],arrayFrom[iold]->getConstPointer(),nameArrayTo,acceleratingStructures[iold]);
}
}
- for (int iold=0; iold<ioldMax;iold++)
+ for (unsigned int iold=0; iold<ioldMax;iold++)
if (isParallelMode() && _domain_selector->isMyDomain(iold))
{
bbox[iold]->decrRef();
const BBTreeOfDim* tree;
bool cleantree=false;
MEDCoupling::DataArrayDouble* sourceBBox=0;
- int dim = targetCoords->getNumberOfComponents();
+ int dim = (int)targetCoords->getNumberOfComponents();
if (myTree==0)
{
sourceBBox=sourceMesh.computeCellCenterOfMass()->computeBBoxPerTuple(1e-8);
toArray=_map_dataarray_int.find(cle)->second->getPointer();
}
- std::map< int, int > isource2nb; // count coincident elements
- std::map<int,int>::iterator i2nb;
+ std::map< mcIdType, int > isource2nb; // count coincident elements
+ std::map< mcIdType, int>::iterator i2nb;
- for (int itargetnode=0; itargetnode<targetSize; itargetnode++)
+ for (mcIdType itargetnode=0; itargetnode<targetSize; itargetnode++)
{
- std::vector<int> intersectingElems;
+ std::vector<mcIdType> intersectingElems;
tree->getElementsAroundPoint(tc+itargetnode*dim,intersectingElems);
if (intersectingElems.size()!=0)
{
- int isourcenode=intersectingElems[0];
+ mcIdType isourcenode=intersectingElems[0];
if ( intersectingElems.size() > 1 )
{
i2nb = isource2nb.insert( std::make_pair( isourcenode, 0 )).first;
std::string nameTo="typeData=6"; //resume the type of field casted
// send-recv operations
- int ioldMax=initialCollection.getMesh().size();
- int inewMax=this->getMesh().size();
- int iFieldMax=initialCollection.getFieldDescriptions().size();
+ std::size_t ioldMax=initialCollection.getMesh().size();
+ std::size_t inewMax=this->getMesh().size();
+ std::size_t iFieldMax=initialCollection.getFieldDescriptions().size();
if (MyGlobals::_Verbose>10)
std::cout << "castAllFields with:\n" << ReprVectorOfString(initialCollection.getFieldDescriptions()) << std::endl;
//see collection.prepareFieldDescriptions()
- for (int ifield=0; ifield<iFieldMax; ifield++)
+ for (std::size_t ifield=0; ifield<iFieldMax; ifield++)
{
std::string descriptionField=initialCollection.getFieldDescriptions()[ifield];
if (descriptionField.find(nameTo)==std::string::npos)
continue; //only nameTo accepted in Fields name description
#ifdef HAVE_MPI
- for (int inew=0; inew<inewMax; inew++)
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
{
//sending arrays for distant domains
if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
}
#endif
//local contributions and aggregation
- for (int inew=0; inew<inewMax; inew++)
+ for (unsigned int inew=0; inew<inewMax; inew++)
{
- for (int iold=0; iold<ioldMax; iold++)
+ for (unsigned int iold=0; iold<ioldMax; iold++)
if (!isParallelMode() || ( _domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)))
{
MEDCoupling::DataArrayDouble* field=initialCollection.getField(descriptionField,iold);
std::string tag="inewFieldDouble="+IntToStr(inew);
key=descriptionField+SerializeFromString(tag);
- int fromArrayNbOfElem=fromArray->getNbOfElems();
- int fromArrayNbOfComp=fromArray->getNumberOfComponents();
- int fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss;
+ mcIdType fromArrayNbOfElem=fromArray->getNbOfElems();
+ mcIdType fromArrayNbOfComp=ToIdType(fromArray->getNumberOfComponents());
+ mcIdType fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss;
if (MyGlobals::_Verbose>1000)
{
mcIdType* pccI=ccI->getPointer();
double* pField=field->getPointer();
double* pFrom=fromArray->getPointer();
- int itarget, isource, delta=nbPtGauss*nbcomp;
- for (int i=0; i<iMax; i=i+2) //cell
+ mcIdType itarget, isource, delta=ToIdType(nbPtGauss*nbcomp);
+ for (mcIdType i=0; i<iMax; i=i+2) //cell
{
itarget=pccI[i];
isource=pccI[i+1];
if ((itarget<0) || (itarget>=nbcell) || (isource<0) || (isource>=fromArrayNbOfCell))
throw INTERP_KERNEL::Exception("Error field override");
- int ita=itarget*delta;
- int iso=isource*delta;
- for (int k=0; k<delta; k++) pField[ita+k]=pFrom[iso+k]; //components and gausspoints
+ mcIdType ita=itarget*delta;
+ mcIdType iso=isource*delta;
+ for (mcIdType k=0; k<delta; k++) pField[ita+k]=pFrom[iso+k]; //components and gausspoints
}
}
}
if ( ++nmIt2 == nmEnd )
break;
int dom1 = nmIt1->second.first;
- int node1 = nmIt1->second.second;
+ mcIdType node1 = nmIt1->second.second;
for ( ; nmIt2 != nmEnd; ++nmIt2 )
{
int dom2 = nmIt2->second.first;
- int node2 = nmIt2->second.second;
+ mcIdType node2 = nmIt2->second.second;
if ( dom1 != dom2 )
{
nodeCorresp[ dom1 ][ dom2 ].push_back( node1 );
czVec.push_back(cz);
}
- cz->setNodeCorresp( &corresp[0], corresp.size()/2 );
+ cz->setNodeCorresp( &corresp[0], ToIdType( corresp.size()/2 ));
}
}
using MEDCoupling::DataArrayInt;
std::vector<MEDCouplingUMesh*>& faceMeshes = getFaceMesh();
- int nbMeshes = faceMeshes.size();
+ std::size_t nbMeshes = faceMeshes.size();
//preparing bounding box trees for accelerating search of coincident faces
std::vector<BBTreeOfDim* > bbTrees(nbMeshes);
std::vector<DataArrayDouble*>bbox (nbMeshes);
- for (int inew = 0; inew < nbMeshes-1; inew++)
+ for (unsigned int inew = 0; inew < nbMeshes-1; inew++)
if ( !isParallelMode() || _domain_selector->isMyDomain(inew) )
{
DataArrayDouble* bcCoords = faceMeshes[inew]->computeCellCenterOfMass();
}
// loop on domains to find joint faces between them
- for (int inew1 = 0; inew1 < nbMeshes; inew1++ )
+ for (unsigned int inew1 = 0; inew1 < nbMeshes; inew1++ )
{
- for (int inew2 = inew1+1; inew2 < nbMeshes; inew2++ )
+ for (unsigned int inew2 = inew1+1; inew2 < nbMeshes; inew2++ )
{
MEDCouplingUMesh* mesh1 = 0;
MEDCouplingUMesh* mesh2 = 0;
if ( mesh2Here && !mesh2 ) mesh2 = faceMeshes[ inew2 ];
// find coincident faces
- std::vector< int > faces1, faces2;
+ std::vector< mcIdType > faces1, faces2;
if ( mesh1 && mesh2 )
{
const DataArrayDouble* coords2 = mesh2->computeCellCenterOfMass();
- const double* c2 = coords2->getConstPointer();
- const int dim = coords2->getNumberOfComponents();
- const int nbFaces2 = mesh2->getNumberOfCells();
- const int nbFaces1 = mesh1->getNumberOfCells();
+ const double* c2 = coords2->getConstPointer();
+ const std::size_t dim = coords2->getNumberOfComponents();
+ const mcIdType nbFaces2 = mesh2->getNumberOfCells();
+ const mcIdType nbFaces1 = mesh1->getNumberOfCells();
- for (int i2 = 0; i2 < nbFaces2; i2++)
+ for (mcIdType i2 = 0; i2 < nbFaces2; i2++)
{
- std::vector<int> coincFaces;
+ std::vector<mcIdType> coincFaces;
bbTrees[inew1]->getElementsAroundPoint( c2+i2*dim, coincFaces );
if (coincFaces.size()!=0)
{
- int i1 = coincFaces[0];
+ mcIdType i1 = coincFaces[0];
// if ( coincFaces.size() > 1 )
// {
// i2nb = isource2nb.insert( std::make_pair( i1 , 0 )).first;
// delete bounding box trees
- for (int inew = 0; inew < nbMeshes-1; inew++)
+ for (unsigned int inew = 0; inew < nbMeshes-1; inew++)
if (isParallelMode() && _domain_selector->isMyDomain(inew))
{
bbox[inew]->decrRef();
*/
//================================================================================
-void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& faces,
+void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< mcIdType >& faces,
const int inew1,
const int inew2,
const bool is2nd )
// remove faces from the familyID-the family
if ( familyID != 0 && famIDs )
- for ( int i = 0; i < totalNbFaces; ++i )
+ for ( mcIdType i = 0; i < totalNbFaces; ++i )
if ( famIDs[i] == familyID )
famIDs[i] = 0;
throw INTERP_KERNEL::Exception("file does not comply with any recognized format");
}
}
- for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain )
+ for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain )
if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 )
_i_non_empty_mesh = idomain;
}
}
}
// find non-empty domain mesh
- for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain )
+ for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain )
if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 )
_i_non_empty_mesh = idomain;
MEDPARTITIONER::MeshCollection::~MeshCollection()
{
- for (int i=0; i<(int)_mesh.size();i++)
+ for (std::size_t i=0; i<_mesh.size();i++)
if (_mesh[i]!=0) _mesh[i]->decrRef();
- for (int i=0; i<(int)_cell_family_ids.size();i++)
+ for (std::size_t i=0; i<_cell_family_ids.size();i++)
if (_cell_family_ids[i]!=0)
_cell_family_ids[i]->decrRef();
- for (int i=0; i<(int)_face_mesh.size();i++)
+ for (std::size_t i=0; i<_face_mesh.size();i++)
if (_face_mesh[i]!=0)
_face_mesh[i]->decrRef();
- for (int i=0; i<(int)_face_family_ids.size();i++)
+ for (std::size_t i=0; i<_face_family_ids.size();i++)
if (_face_family_ids[i]!=0)
_face_family_ids[i]->decrRef();
return nb;
}
-int MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const
+mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const
{
- int nb=0;
+ mcIdType nb=0;
for (size_t i=0; i<_mesh.size(); i++)
{
if (_mesh[i]) nb=nb+_mesh[i]->getNumberOfCells();
return nb;
}
-int MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const
+mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const
{
- int nb=0;
+ mcIdType nb=0;
for (size_t i=0; i<_face_mesh.size(); i++)
{
if (_face_mesh[i]) nb=nb+_face_mesh[i]->getNumberOfCells();
using std::make_pair;
using std::pair;
- std::multimap< int, int > node2cell;
- std::map< pair<int,int>, int > cell2cellcounter;
- std::multimap<int,int> cell2cell;
+ std::multimap< mcIdType, mcIdType > node2cell;
+ std::map< pair<mcIdType,mcIdType>, mcIdType > cell2cellcounter;
+ std::multimap<mcIdType,mcIdType> cell2cell;
- std::vector<std::vector<std::multimap<int,int> > > commonDistantNodes;
+ std::vector<std::vector<std::multimap<mcIdType,mcIdType> > > commonDistantNodes;
int nbdomain=_topology->nbDomain();
#ifdef HAVE_MPI
if (isParallelMode())
MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New();
MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New();
- int nbNodes=_mesh[idomain]->getNumberOfNodes();
+ mcIdType nbNodes=_mesh[idomain]->getNumberOfNodes();
_mesh[idomain]->getReverseNodalConnectivity(revConn,index);
//problem saturation over 1 000 000 nodes for 1 proc
if (MyGlobals::_Verbose>100)
std::cout << "proc " << MyGlobals::_Rank << " : getReverseNodalConnectivity done on " << nbNodes << " nodes" << std::endl;
mcIdType* index_ptr=index->getPointer();
mcIdType* revConnPtr=revConn->getPointer();
- for (int i=0; i<nbNodes; i++)
+ for (mcIdType i=0; i<nbNodes; i++)
{
for (mcIdType icell=index_ptr[i]; icell<index_ptr[i+1]; icell++)
{
#ifdef HAVE_MPI
for (int iother=0; iother<nbdomain; iother++)
{
- std::multimap<int,int>::iterator it;
+ std::multimap<mcIdType,mcIdType>::iterator it;
int isource=idomain;
int itarget=iother;
for (it=_joint_finder->getDistantNodeCell()[isource][itarget].begin();
it!=_joint_finder->getDistantNodeCell()[isource][itarget].end(); it++)
{
- int globalNode=_topology->convertNodeToGlobal(idomain,(*it).first);
- int globalCell=(*it).second;
+ mcIdType globalNode=_topology->convertNodeToGlobal(idomain,(*it).first);
+ mcIdType globalCell=(*it).second;
node2cell.insert(make_pair(globalNode, globalCell));
}
}
if (MyGlobals::_Verbose>50)
std::cout<< "proc " << MyGlobals::_Rank << " : creating graph arcs on nbNodes " << _topology->nbNodes() << std::endl;
- for (int inode=0;inode<_topology->nbNodes();inode++)
+ for (mcIdType inode=0;inode<_topology->nbNodes();inode++)
{
- typedef multimap<int,int>::const_iterator MI;
+ typedef multimap<mcIdType,mcIdType>::const_iterator MI;
std::pair <MI,MI> nodeRange=node2cell.equal_range(inode);
for (MI cell1=nodeRange.first;cell1!=nodeRange.second;cell1++)
for (MI cell2=nodeRange.first;cell2!=cell1;cell2++)
{
- int icell1=cell1->second;
- int icell2=cell2->second;
- if (icell1>icell2) {int tmp=icell1; icell1=icell2; icell2=tmp;}
- std::map<pair<int,int>,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
+ mcIdType icell1=cell1->second;
+ mcIdType icell2=cell2->second;
+ if (icell1>icell2) std::swap(icell1,icell2);
+ std::map<pair<mcIdType,mcIdType>,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1));
else (it->second)++;
}
}
- // for (int icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes
+ // for (mcIdType icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes
// {
- // typedef multimap<int,int>::const_iterator MI;
+ // typedef multimap<int,mcIdType>::const_iterator MI;
// std::pair <MI,MI> nodeRange=cell2node.equal_range(icell1);
// for (MI node1=nodeRange.first; node1!=nodeRange.second; node1++) //on nodes with icell
// {
// std::pair<MI,MI> cellRange=node2cell.equal_range(node1->second);
// for (MI cell2=cellRange.first; cell2!=cellRange.second; cell2++) //on one of these cell
// {
- // int icell2=cell2->second;
- // std::map<pair<int,int>,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
+ // mcIdType icell2=cell2->second;
+ // std::map<pair<int,mcIdType>,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2));
// if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1));
// else (it->second)++;
// }
//converting the counter to a multimap structure
- for (std::map<pair<int,int>,int>::const_iterator it=cell2cellcounter.begin();
+ for (std::map<pair<mcIdType,mcIdType>,mcIdType>::const_iterator it=cell2cellcounter.begin();
it!=cell2cellcounter.end();
it++)
if (it->second>=meshDim)
//filling up index and value to create skylinearray structure
std::vector <mcIdType> index,value;
index.push_back(0);
- int idep=0;
+ mcIdType idep=0;
for (int idomain=0; idomain<nbdomain; idomain++)
{
if (isParallelMode() && !_domain_selector->isMyDomain(idomain)) continue;
- int nbCells=_mesh[idomain]->getNumberOfCells();
- for (int icell=0; icell<nbCells; icell++)
+ mcIdType nbCells=_mesh[idomain]->getNumberOfCells();
+ for (mcIdType icell=0; icell<nbCells; icell++)
{
- int size=0;
- int globalCell=_topology->convertCellToGlobal(idomain,icell);
- multimap<int,int>::iterator it;
- pair<multimap<int,int>::iterator,multimap<int,int>::iterator> ret;
+ mcIdType size=0;
+ mcIdType globalCell=_topology->convertCellToGlobal(idomain,icell);
+ multimap<mcIdType,mcIdType>::iterator it;
+ pair<multimap<mcIdType,mcIdType>::iterator,multimap<mcIdType,mcIdType>::iterator> ret;
ret=cell2cell.equal_range(globalCell);
for (it=ret.first; it!=ret.second; ++it)
{
- int ival=(*it).second; //no adding one existing yet
- for (int i=idep ; i<idep+size ; i++)
+ mcIdType ival=(*it).second; //no adding one existing yet
+ for (mcIdType i=idep ; i<idep+size ; i++)
{
if (value[i]==ival)
{
{
std::cout << "\nproc " << _domain_selector->rank() << " : end MeshCollection::buildCellGraph " <<
index.size()-1 << " " << value.size() << std::endl;
- int max=index.size()>15?15:index.size();
+ std::size_t max=index.size()>15?15:index.size();
if (index.size()>1)
{
- for (int i=0; i<max; ++i)
+ for (std::size_t i=0; i<max; ++i)
std::cout<<index[i]<<" ";
std::cout << "... " << index[index.size()-1] << std::endl;
- for (int i=0; i<max; ++i)
+ for (std::size_t i=0; i<max; ++i)
std::cout<< value[i] << " ";
- int ll=index[index.size()-1]-1;
+ mcIdType ll=index[index.size()-1]-1;
std::cout << "... (" << ll << ") " << value[ll-1] << " " << value[ll] << std::endl;
}
}
*
* returns a topology based on the new partition
*/
-MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const mcIdType* partition)
+MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const int* partition)
{
MEDCoupling::MEDCouplingSkyLineArray* array=0;
int* edgeweights=0;
Graph* cellGraph;
std::set<int> domains;
- for (int i=0; i<_topology->nbCells(); i++)
+ for (mcIdType i=0; i<_topology->nbCells(); i++)
{
domains.insert(partition[i]);
}
//cellGraph is a shared pointer
Topology *topology=0;
- int nbdomain=domains.size();
+ int nbdomain=(int)domains.size();
topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension());
// if (array!=0) delete array;
delete cellGraph;
//to have unique valid fields names/pointers/descriptions for partitionning
//filter _field_descriptions to be in all procs compliant and equal
{
- int nbfiles=MyGlobals::_File_Names.size(); //nb domains
+ std::size_t nbfiles=MyGlobals::_File_Names.size(); //nb domains
if (nbfiles==0)
{
nbfiles=_topology->nbDomain();
}
std::vector<std::string> r2;
//from allgatherv then vector(procs) of serialised vector(fields) of vector(description) data
- for (int i=0; i<(int)_field_descriptions.size(); i++)
+ for (std::size_t i=0; i<_field_descriptions.size(); i++)
{
std::vector<std::string> r1=DeserializeToVectorOfString(_field_descriptions[i]);
- for (int ii=0; ii<(int)r1.size(); ii++)
+ for (std::size_t ii=0; ii<r1.size(); ii++)
r2.push_back(r1[ii]);
}
//here vector(procs*fields) of serialised vector(description) data
_field_descriptions=r2;
- int nbfields=_field_descriptions.size(); //on all domains
+ std::size_t nbfields=_field_descriptions.size(); //on all domains
if ((nbfields%nbfiles)!=0)
{
if (MyGlobals::_Rank==0)
throw INTERP_KERNEL::Exception("incoherent number of fields references in all files .med\n");
}
_field_descriptions.resize(nbfields/nbfiles);
- for (int i=0; i<(int)_field_descriptions.size(); i++)
+ for (std::size_t i=0; i<_field_descriptions.size(); i++)
{
std::string str=_field_descriptions[i];
str=EraseTagSerialized(str,"idomain=");
//returns true if inodes of a face are in inodes of a cell
bool isFaceOncell(std::vector< mcIdType >& inodesFace, std::vector< mcIdType >& inodesCell)
{
- int ires=0;
- int nbok=inodesFace.size();
- for (int i=0; i<nbok; i++)
+ std::size_t ires=0;
+ std::size_t nbok=inodesFace.size();
+ for (std::size_t i=0; i<nbok; i++)
{
mcIdType ii=inodesFace[i];
if (ii<0)
std::cout << "isFaceOncell problem inodeface<0" << std::endl;
- for (int j=0; j<(int)inodesCell.size(); j++)
+ for (std::size_t j=0; j<inodesCell.size(); j++)
{
if (ii==inodesCell[j])
{
MEDCoupling::MEDCouplingUMesh* mfac=_face_mesh[inew];
//to have cellnode=f(facenode)... inodeCell=nodeIds[inodeFace]
- std::vector<int> nodeIds;
+ std::vector<mcIdType> nodeIds;
getNodeIds(*mcel, *mfac, nodeIds);
if (nodeIds.size()==0)
continue; //one empty mesh nothing to do
bool ok;
std::vector< mcIdType > inodesFace;
mfac->getNodeIdsOfCell(iface, inodesFace);
- int nbnodFace=inodesFace.size();
+ mcIdType nbnodFace=ToIdType(inodesFace.size());
if ( nbnodFace != mfac->getNumberOfNodesInCell( iface ))
continue; // invalid node ids
//set inodesFace in mcel
nbok += (( inodesFace[i]=nodeIds[inodesFace[i]] ) >= 0 );
if ( nbok != nbnodFace )
continue;
- int inod=inodesFace[0];
+ mcIdType inod=inodesFace[0];
if (inod<0)
{
std::cout << "filterFaceOnCell problem 1" << std::endl;
continue;
}
- int nbcell=revIndxC[inod+1]-revIndxC[inod];
- for (int j=0; j<nbcell; j++) //look for each cell with inod
+ mcIdType nbcell=revIndxC[inod+1]-revIndxC[inod];
+ for (mcIdType j=0; j<nbcell; j++) //look for each cell with inod
{
mcIdType icel=revC[revIndxC[inod]+j];
std::vector< mcIdType > inodesCell;
class JointFinder;
typedef enum{MedAscii, MedXml, Undefined} DriverType;
- typedef std::multimap<std::pair<int,int>, std::pair<int,int> > NodeMapping ;
+ typedef std::multimap<std::pair<int,mcIdType>, std::pair<int,mcIdType> > NodeMapping ;
typedef std::vector<std::pair<int,int> > NodeList;
class MEDPARTITIONER_EXPORT MeshCollection
const std::string& ="", int* edgeweights=0, int* verticesweights=0);
//creation of a user specified partition
- Topology* createPartition(const mcIdType* partition);
+ Topology* createPartition(const int* partition);
//getting mesh dimension
int getMeshDimension() const;
int getNbOfLocalMeshes() const;
- int getNbOfGlobalMeshes() const { return _mesh.size(); }
- int getNbOfLocalCells() const;
- int getNbOfLocalFaces() const;
+ int getNbOfGlobalMeshes() const { return (int)_mesh.size(); }
+ mcIdType getNbOfLocalCells() const;
+ mcIdType getNbOfLocalFaces() const;
//getting a reference to mesh vector
std::vector<MEDCoupling::MEDCouplingUMesh*>& getMesh();
//creates the node mapping between an old collection and the present one
void createNodeMapping(MeshCollection& initialCollection,
- std::multimap<std::pair<int,int>,std::pair<int,int> >& nodeMapping);
+ std::multimap<std::pair<int,mcIdType>,std::pair<int,mcIdType> >& nodeMapping);
void castCellMeshes(MeshCollection& initialCollection,
std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds,
//creates faces on the new collection
void castFaceMeshes(MeshCollection& initialCollection,
- const std::multimap<std::pair<int,int>, std::pair<int,int> >& nodeMapping,
+ const std::multimap<std::pair<int,mcIdType>, std::pair<int,mcIdType> >& nodeMapping,
std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds);
//constructing connect zones
void castAllFields(MeshCollection& initialCollection,
std::string nameArrayTo);
- void findCommonDistantNodes(std::vector<std::vector<std::multimap<int,int> > >& commonDistantNodes);
+ void findCommonDistantNodes(std::vector<std::vector<std::multimap<int,mcIdType> > >& commonDistantNodes);
void remapIntField(int inew, int iold,
std::string nameArrayTo,
std::string descriptionField);
- void createJointGroup( const std::vector< int >& faces,
+ void createJointGroup( const std::vector< mcIdType >& faces,
const int inew1,
const int inew2,
const bool is2nd );
j1st->pushCorrespondence( corr );
}
- std::vector< std::pair< int,int > > types = cz->getEntities();
+ std::vector< std::pair< mcIdType,mcIdType > > types = cz->getEntities();
INTERP_KERNEL::NormalizedCellType t1, t2;
for ( size_t it = 0; it < types.size(); ++it )
{
std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
if (nbc==da->getNumberOfComponents())
{
- for (std::size_t i=0; i<nbc; i++)
+ for (unsigned int i=0; i<nbc; i++)
da->setInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"="));
}
else
meshes = MEDCoupling::MEDFileMeshes::New();
fields = MEDCoupling::MEDFileFields::New();
- for (size_t i=0; i<_collection->getMesh().size(); i++)
+ for (unsigned int i=0; i<_collection->getMesh().size(); i++)
{
MEDCoupling::MEDFileMesh* mfm = getMesh( i );
meshes->pushMesh(mfm);
readMEDFileData(filedata);
std::vector<MEDPARTITIONER::ConnectZone*> cz; // to fill from filedata
- std::vector<int*> cellglobal;
- std::vector<int*> nodeglobal;
- std::vector<int*> faceglobal;
- int size = (_collection->getMesh()).size();
+ std::vector<mcIdType*> cellglobal;
+ std::vector<mcIdType*> nodeglobal;
+ std::vector<mcIdType*> faceglobal;
+ std::size_t size = _collection->getMesh().size();
cellglobal.resize(size);
nodeglobal.resize(size);
faceglobal.resize(size);
- for ( int idomain = 0; idomain < size; ++idomain )
+ for ( unsigned int idomain = 0; idomain < size; ++idomain )
{
cellglobal[idomain]=0;
faceglobal[idomain]=0;
int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* domainSelector)
{
//distributed meshes
- std::vector<int*> cellglobal;
- std::vector<int*> nodeglobal;
- std::vector<int*> faceglobal;
+ std::vector<mcIdType*> cellglobal;
+ std::vector<mcIdType*> nodeglobal;
+ std::vector<mcIdType*> faceglobal;
int nbdomain;
//reading ascii master file
*/
void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector) const
{
- int nbdomains=_collection->getMesh().size();
+ std::size_t nbdomains=_collection->getMesh().size();
std::vector<std::string> filenames;
filenames.resize(nbdomains);
//loop on the domains
- for (int idomain=0; idomain<nbdomains; idomain++)
+ for (unsigned idomain=0; idomain<nbdomains; idomain++)
{
std::string distfilename;
std::ostringstream suffix;
file << "#" << " " << std::endl;
file << _collection->getMesh().size() << " " << std::endl;
- for (int idomain=0; idomain<nbdomains; idomain++)
+ for (std::size_t idomain=0; idomain<nbdomains; idomain++)
file << _collection->getName() <<" "<< idomain+1 << " "
<< (_collection->getMesh())[idomain]->getName() << " localhost "
<< filenames[idomain] << " "<< std::endl;
xmlNodePtr mesh_node = xmlNewChild(node, 0, BAD_CAST "mesh",0);
xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST _collection->getName().c_str());
- int nbdomains= _collection->getMesh().size();
+ int nbdomains= _collection->getNbOfGlobalMeshes();
//loop on the domains
std::string finalMeshName="";
std::cout << "proc " << MyGlobals::_Rank << " : PTSCOTCHGraph::partGraph" << std::endl;
//number of graph vertices
- int n = _graph->getNumberOf();
+ int n = FromIdType<int>(_graph->getNumberOf());
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
//ndomain
int nparts=ndomain;
SCOTCH_stratExit(&scotch_strategy);
SCOTCH_dgraphExit(&scotch_graph);
- std::vector<int> index(n+1);
- std::vector<int> value(n);
+ std::vector<mcIdType> index(n+1);
+ std::vector<mcIdType> value(n);
index[0]=0;
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
delete [] partition;
_partition = MEDCoupling::MEDCouplingSkyLineArray::New(index,value);
#endif
}
-
std::cout << "proc " << MyGlobals::_Rank << " : ParMETISGraph::partGraph" << std::endl;
// number of graph vertices
- int n=_graph->getNumberOf();
+ int n=FromIdType<int>(_graph->getNumberOf());
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
++#endif
//constraints
int * vwgt=_cell_weight;
int * adjwgt=_edge_weight;
MPI_Comm *comm);
*/
- vector<int> index(n+1);
- vector<int> value(n);
+ vector<mcIdType> index(n+1);
+ vector<mcIdType> value(n);
index[0]=0;
if (ran.size()>0 && MyGlobals::_Atomize==0) //there is randomize
{
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[ran[i]]=partition[i];
+ value[ran[i]]=ToIdType(partition[i]);
}
}
else
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
}
delete [] partition;
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_UserGraph.hxx"
#include "MEDPARTITIONER_Utils.hxx"
+#include "MEDPARTITIONER_Utils.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingSkyLineArray.hxx"
+#include "MCIdType.hxx"
#include <iostream>
#include <numeric>
#ifdef HAVE_MPI
+
#include <mpi.h>
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+#define MPI_ID_TYPE MPI_INT
+#else
+#define MPI_ID_TYPE MPI_LONG
+#endif
+
#endif
/*!
{
evaluateMemory();
// get nb of elems of each domain mesh
- int nb_domains=domain_meshes.size();
- std::vector<int> nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes
+ int nb_domains=(int)domain_meshes.size();
+ std::vector<mcIdType> nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes
for (int i=0; i<nb_domains; ++i)
if ( domain_meshes[i] )
{
nb_elems[i*2+1] = domain_meshes[i]->getNumberOfNodes();
}
// receive nb of elems from other procs
- std::vector<int> all_nb_elems;
+ std::vector<mcIdType> all_nb_elems;
if (MyGlobals::_World_Size==1)
{
all_nb_elems=nb_elems;
{
#ifdef HAVE_MPI
all_nb_elems.resize( nb_domains*2 );
- MPI_Allreduce((void*)&nb_elems[0], (void*)&all_nb_elems[0], nb_domains*2, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+ MPI_Allreduce((void*)&nb_elems[0], (void*)&all_nb_elems[0], nb_domains*2, MPI_ID_TYPE, MPI_SUM, MPI_COMM_WORLD);
#else
throw INTERP_KERNEL::Exception("not(HAVE_MPI) incompatible with MPI_World_Size>1");
#endif
}
- int total_nb_cells=0, total_nb_nodes=0;
+ mcIdType total_nb_cells=0, total_nb_nodes=0;
for (int i=0; i<nb_domains; ++i)
{
total_nb_cells+=all_nb_elems[i*2];
if (MyGlobals::_Is0verbose>10)
std::cout << "totalNbCells " << total_nb_cells << " totalNbNodes " << total_nb_nodes << std::endl;
- std::vector<int>& cell_shift_by_domain=_cell_shift_by_domain;
- std::vector<int>& node_shift_by_domain=_node_shift_by_domain;
- std::vector<int>& face_shift_by_domain=_face_shift_by_domain;
+ std::vector<mcIdType>& cell_shift_by_domain=_cell_shift_by_domain;
+ std::vector<mcIdType>& node_shift_by_domain=_node_shift_by_domain;
+ std::vector<mcIdType>& face_shift_by_domain=_face_shift_by_domain;
- std::vector< int > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains);
+ std::vector< mcIdType > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains);
ordered_nbs_cell.push_back(0);
ordered_nbs_node.push_back(0);
for (int iproc=0; iproc<nbProcs(); ++iproc)
for (int idomain=0; idomain<nb_domains; ++idomain)
if (getProcessorID( idomain )==iproc)
{
- domain_order[idomain] = ordered_nbs_cell.size() - 1;
+ domain_order[idomain] = ToIdType( ordered_nbs_cell.size() - 1 );
ordered_nbs_cell.push_back( ordered_nbs_cell.back() + all_nb_elems[idomain*2] );
ordered_nbs_node.push_back( ordered_nbs_node.back() + all_nb_elems[idomain*2+1] );
}
* The result array is to be used as the first arg of ParMETIS_V3_PartKway() and
* is freed by ParaDomainSelector.
*/
-int *MEDPARTITIONER::ParaDomainSelector::getProcVtxdist() const
+mcIdType *MEDPARTITIONER::ParaDomainSelector::getProcVtxdist() const
{
evaluateMemory();
if (_nb_vert_of_procs.empty())
throw INTERP_KERNEL::Exception("_nb_vert_of_procs not set");
- return const_cast<int*>(& _nb_vert_of_procs[0]);
+ return const_cast<mcIdType*>(& _nb_vert_of_procs[0]);
}
/*!
* gatherNbOf() must be called before.
* Result added to local id on given domain gives id in the whole distributed mesh
*/
-int MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const
{
evaluateMemory();
if (_cell_shift_by_domain.empty())
return _cell_shift_by_domain[domainIndex];
}
-int MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const
{
evaluateMemory();
if (_node_shift_by_domain.empty())
* gatherNbOf() must be called before.
* Result added to global id on this processor gives id in the whole distributed mesh
*/
-int MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const
{
evaluateMemory();
if (_nb_vert_of_procs.empty())
std::vector<int> index_size_of_proc( nbProcs() ); // index sizes - 1
for ( std::size_t i = 1; i < _nb_vert_of_procs.size(); ++i )
- index_size_of_proc[i-1] = _nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ];
+ index_size_of_proc[i-1] = FromIdType<int>(_nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]);
- int index_size = 1 + _cell_shift_by_domain.back();
- int *graph_index = new int[ index_size ];
- const int *index = graph->getGraph()->getIndex();
- int *proc_index_displacement = const_cast<int*>( & _nb_vert_of_procs[0] );
+ mcIdType index_size = 1 + _cell_shift_by_domain.back();
+ mcIdType *graph_index = new mcIdType[ index_size ];
+ const mcIdType *index = graph->getGraph()->getIndex();
+ MCAuto< DataArrayInt > nb_vert_of_procs = FromIdTypeVec( _nb_vert_of_procs );
+ int *proc_index_displacement = nb_vert_of_procs->getPointer();
MPI_Allgatherv((void*) (index+1), // send local index except first 0 (or 1)
index_size_of_proc[_rank], // index size on this proc
- MPI_INT,
+ MPI_ID_TYPE,
(void*) graph_index, // receive indices
& index_size_of_proc[0], // index size on each proc
proc_index_displacement, // displacement of each proc index
- MPI_INT,
+ MPI_ID_TYPE,
MPI_COMM_WORLD);
graph_index[0] = index[0]; // it is not overwritten thanks to proc_index_displacement[0]==1
for ( int i = 0; i < nbProcs(); ++i )
{
if ( index_size_of_proc[i] > 0 )
- value_size_of_proc[i] = graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0];
+ value_size_of_proc[i] = (int)(graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0]);
else
value_size_of_proc[i] = 0;
proc_value_displacement.push_back( proc_value_displacement.back() + value_size_of_proc[i] );
// update graph_index
for ( int i = 1; i < nbProcs(); ++i )
{
- int shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0];
+ mcIdType shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0];
for ( int j = proc_index_displacement[i]; j < proc_index_displacement[i+1]; ++j )
graph_index[ j ] += shift;
}
// Gather values
// --------------
- int value_size = graph_index[ index_size-1 ] - graph_index[ 0 ];
- int *graph_value = new int[ value_size ];
- const int *value = graph->getGraph()->getValues();
+ mcIdType value_size = graph_index[ index_size-1 ] - graph_index[ 0 ];
+ mcIdType *graph_value = new mcIdType[ value_size ];
+ const mcIdType *value = graph->getGraph()->getValues();
MPI_Allgatherv((void*) value, // send local value
value_size_of_proc[_rank], // value size on this proc
- MPI_INT,
+ MPI_ID_TYPE,
(void*) graph_value, // receive values
& value_size_of_proc[0], // value size on each proc
& proc_value_displacement[0], // displacement of each proc value
- MPI_INT,
+ MPI_ID_TYPE,
MPI_COMM_WORLD);
// -----------------
// Gather partition
// -----------------
- int * partition = new int[ _cell_shift_by_domain.back() ];
- const int* part = graph->getPart();
+ mcIdType * partition = new mcIdType[ _cell_shift_by_domain.back() ];
+ const mcIdType* part = graph->getPart();
MPI_Allgatherv((void*) part, // send local partition
index_size_of_proc[_rank], // index size on this proc
- MPI_INT,
+ MPI_ID_TYPE,
(void*)(partition-1), // -1 compensates proc_index_displacement[0]==1
& index_size_of_proc[0], // index size on each proc
proc_index_displacement, // displacement of each proc index
- MPI_INT,
+ MPI_ID_TYPE,
MPI_COMM_WORLD);
// -----------
/*!
* \brief Set nb of cell/cell pairs in a joint between domains
*/
-void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain )
+void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( mcIdType nb_cell_pairs, int dist_domain, int loc_domain )
{
// This method is needed for further computing global numbers of faces in joint.
// Store if both domains are on this proc else on one of procs only
*/
//================================================================================
-int MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const
{
evaluateMemory();
_nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0);
evaluateMemory();
- std::vector< int > send_buf = _nb_cell_pairs_by_joint;
+ std::vector< mcIdType > send_buf = _nb_cell_pairs_by_joint;
#ifdef HAVE_MPI
MPI_Allreduce((void*)&send_buf[0],
(void*)&_nb_cell_pairs_by_joint[0],
- _nb_cell_pairs_by_joint.size(),
- MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+ (int)_nb_cell_pairs_by_joint.size(),
+ MPI_ID_TYPE, MPI_SUM, MPI_COMM_WORLD);
#endif
// check that the set nbs of cell pairs are correct,
// namely that each joint is treated on one proc only
*/
//================================================================================
-int MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const
+mcIdType MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const
{
// total_nb_faces includes faces existing before creation of joint faces
// (got in gatherNbOf( MED_FACE )).
evaluateMemory();
- int total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back();
- int id = total_nb_faces + 1;
+ mcIdType total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back();
+ mcIdType id = total_nb_faces + 1;
if ( _nb_cell_pairs_by_joint.empty() )
throw INTERP_KERNEL::Exception("gatherNbCellPairs() must be called before");
int dest = getProcessorID( dist_domain );
int tag = 2002 + jointId( loc_domain, dist_domain );
MPI_Status status;
- MPI_Sendrecv((void*)&loc_ids_here[0], loc_ids_here.size(), MPI_INT, dest, tag,
- (void*) loc_ids_dist, loc_ids_here.size(), MPI_INT, dest, tag,
+ MPI_Sendrecv((void*)&loc_ids_here[0], (int)loc_ids_here.size(), MPI_INT, dest, tag,
+ (void*) loc_ids_dist, (int)loc_ids_here.size(), MPI_INT, dest, tag,
MPI_COMM_WORLD, &status);
#endif
evaluateMemory();
std::cout << "proc " << _rank << " : sendMesh '" << mesh.getName() << "' size " << mesh.getNumberOfCells() << " to " << target << std::endl;
// First stage : sending sizes
// ------------------------------
- std::vector<int> tinyInfoLocal;
+ std::vector<mcIdType> tinyInfoLocal;
std::vector<std::string> tinyInfoLocalS;
std::vector<double> tinyInfoLocalD;
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
//the transmitted mesh.
mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
tinyInfoLocal.push_back(mesh.getNumberOfCells());
- int tinySize=tinyInfoLocal.size();
+ int tinySize=(int)tinyInfoLocal.size();
MPI_Send(&tinySize, 1, MPI_INT, target, 1113, MPI_COMM_WORLD);
- MPI_Send(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, target, 1112, MPI_COMM_WORLD);
+ MPI_Send(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, target, 1112, MPI_COMM_WORLD);
if (mesh.getNumberOfCells()>0) //no sends if empty
{
- MEDCoupling::DataArrayInt *v1Local=0;
+ MEDCoupling::DataArrayIdType *v1Local=0;
MEDCoupling::DataArrayDouble *v2Local=0;
//serialization of local mesh to send data to distant proc.
mesh.serialize(v1Local,v2Local);
int nbLocalElems=0;
- int* ptLocal=0;
+ mcIdType* ptLocal=0;
if(v1Local) //if empty getNbOfElems() is 1!
{
- nbLocalElems=v1Local->getNbOfElems(); // if empty be 1!
+ nbLocalElems=FromIdType<int>(v1Local->getNbOfElems()); // if empty be 1!
ptLocal=v1Local->getPointer();
}
- MPI_Send(ptLocal, nbLocalElems, MPI_INT, target, 1111, MPI_COMM_WORLD);
+ MPI_Send(ptLocal, nbLocalElems, MPI_ID_TYPE, target, 1111, MPI_COMM_WORLD);
int nbLocalElems2=0;
double *ptLocal2=0;
if(v2Local) //if empty be 0!
{
- nbLocalElems2=v2Local->getNbOfElems();
+ nbLocalElems2=FromIdType<int>(v2Local->getNbOfElems());
ptLocal2=v2Local->getPointer();
}
MPI_Send(ptLocal2, nbLocalElems2, MPI_DOUBLE, target, 1110, MPI_COMM_WORLD);
#else
// First stage : exchanging sizes
// ------------------------------
- std::vector<int> tinyInfoDistant;
+ std::vector<mcIdType> tinyInfoDistant;
std::vector<std::string> tinyInfoLocalS;
std::vector<double> tinyInfoDistantD(1);
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
tinyInfoDistant.resize(tinyVecSize);
std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0);
- MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_INT,source,1112,MPI_COMM_WORLD, &status);
+ MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_ID_TYPE,source,1112,MPI_COMM_WORLD, &status);
//there was tinyInfoLocal.push_back(mesh.getNumberOfCells());
- int NumberOfCells=tinyInfoDistant[tinyVecSize-1];
+ mcIdType NumberOfCells=tinyInfoDistant[tinyVecSize-1];
if (NumberOfCells>0)
{
- MEDCoupling::DataArrayInt *v1Distant=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType *v1Distant=MEDCoupling::DataArrayIdType::New();
MEDCoupling::DataArrayDouble *v2Distant=MEDCoupling::DataArrayDouble::New();
//Building the right instance of copy of distant mesh.
MEDCoupling::MEDCouplingPointSet *distant_mesh_tmp=
mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
int nbDistElem=0;
- int *ptDist=0;
+ mcIdType *ptDist=0;
if(v1Distant)
{
- nbDistElem=v1Distant->getNbOfElems();
+ nbDistElem=FromIdType<int>(v1Distant->getNbOfElems());
ptDist=v1Distant->getPointer();
}
- MPI_Recv(ptDist, nbDistElem, MPI_INT, source,1111, MPI_COMM_WORLD, &status);
+ MPI_Recv(ptDist, nbDistElem, MPI_ID_TYPE, source,1111, MPI_COMM_WORLD, &status);
double *ptDist2=0;
nbDistElem=0;
if(v2Distant)
{
- nbDistElem=v2Distant->getNbOfElems();
+ nbDistElem=FromIdType<int>(v2Distant->getNbOfElems());
ptDist2=v2Distant->getPointer();
}
MPI_Recv(ptDist2, nbDistElem, MPI_DOUBLE,source, 1110, MPI_COMM_WORLD, &status);
struct sysinfo si;
int err = sysinfo( &si );
if ( !err )
- used_memory = (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024;
+ used_memory = (int)(( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024;
#endif
if ( used_memory > _max_memory )
_max_memory = used_memory;
#define __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <memory>
#include <vector>
//identifier for a joint
int jointId( int local_domain, int distant_domain ) const;
- int getNbTotalCells() { return _cell_shift_by_domain.back(); }
- int getNbTotalNodes() { return _node_shift_by_domain.back(); };
- int getNbTotalFaces() { return _face_shift_by_domain.back(); };
+ mcIdType getNbTotalCells() { return _cell_shift_by_domain.back(); }
+ mcIdType getNbTotalNodes() { return _node_shift_by_domain.back(); };
+ mcIdType getNbTotalFaces() { return _face_shift_by_domain.back(); };
//Collect nb of entities on procs
void gatherNbOf(const std::vector<MEDCoupling::MEDCouplingUMesh*>& domain_meshes);
//distribution of the graph vertices among the processors
- int* getProcVtxdist() const;
+ mcIdType* getProcVtxdist() const;
//nb of nodes on processors with lower rank
- int getProcNodeShift() const;
+ mcIdType getProcNodeShift() const;
//nb of cells in domains with lower index
- int getDomainCellShift(int domainIndex) const;
+ mcIdType getDomainCellShift(int domainIndex) const;
//nb of nodes in domains with lower index
- int getDomainNodeShift(int domainIndex) const;
+ mcIdType getDomainNodeShift(int domainIndex) const;
//Gather graphs from all processors into one
std::unique_ptr<Graph> gatherGraph(const Graph* graph) const;
//Set nb of cell/cell pairs in a joint between domains
- void setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain );
+ void setNbCellPairs( mcIdType nb_cell_pairs, int dist_domain, int loc_domain );
//Gather size of each proc/proc joint
void gatherNbCellPairs();
//nb of cell/cell pairs in a joint between domains on different procs
- int getNbCellPairs( int dist_domain, int loc_domain ) const;
+ mcIdType getNbCellPairs( int dist_domain, int loc_domain ) const;
//get the first global id of sub-entity for the joint
- int getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const;
+ mcIdType getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const;
//Send-receive local ids of joint faces
int* exchangeSubentityIds( int loc_domain, int dist_domain,
const std::vector<int>& loc_ids_here ) const;
int _world_size; //nb of processors
int _nb_result_domains; //required nb of domains
- std::vector< int > _nb_cell_pairs_by_joint;
- std::vector< int > _nb_vert_of_procs; //graph vertices
- std::vector< int > _cell_shift_by_domain;
- std::vector< int > _node_shift_by_domain;
- std::vector< int > _face_shift_by_domain;
+ std::vector< mcIdType > _nb_cell_pairs_by_joint;
+ std::vector< mcIdType > _nb_vert_of_procs; //graph vertices
+ std::vector< mcIdType > _cell_shift_by_domain;
+ std::vector< mcIdType > _node_shift_by_domain;
+ std::vector< mcIdType > _face_shift_by_domain;
double _init_time;
bool _mesure_memory;
#include "MEDCouplingSkyLineArray.hxx"
#include "MEDCouplingUMesh.hxx"
#include "InterpKernelHashMap.hxx"
+#include "MCIdType.hxx"
#include <set>
#include <map>
//constructing topology according to mesh collection without global numerotation (use setGlobalNumerotation later)
ParallelTopology::ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>& meshes)
{
- _nb_domain=meshes.size();
+ _nb_domain=(int)meshes.size();
_nb_cells.resize(_nb_domain);
_nb_nodes.resize(_nb_domain);
// _nb_faces.resize(_nb_domain);
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_loc_to_glob[idomain].resize(_nb_cells[idomain]);
- int domainCellShift=domainSelector->getDomainCellShift(idomain);
- for (int i=0; i<_nb_cells[idomain]; i++)
+ mcIdType domainCellShift=domainSelector->getDomainCellShift(idomain);
+ for (mcIdType i=0; i<_nb_cells[idomain]; i++)
{
- int global=domainCellShift+i ;
+ mcIdType global=domainCellShift+i ;
_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_loc_to_glob[idomain][i]=global;
if (MyGlobals::_Verbose>500)
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
- int domainNodeShift=domainSelector->getDomainNodeShift(idomain);
- for (int i=0; i<_nb_nodes[idomain]; i++)
+ mcIdType domainNodeShift=domainSelector->getDomainNodeShift(idomain);
+ for (mcIdType i=0; i<_nb_nodes[idomain]; i++)
{
- int global=domainNodeShift+i ;
+ mcIdType global=domainNodeShift+i ;
_node_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_node_loc_to_glob[idomain][i]=global;
if (MyGlobals::_Verbose>500)
//constructing topology according to mesh collection
ParallelTopology::ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>& meshes,
const std::vector<MEDPARTITIONER::ConnectZone*>& cz,
- std::vector<int*>& cellglobal,
- std::vector<int*>& nodeglobal,
- std::vector<int*>& faceglobal)
+ std::vector<mcIdType*>& cellglobal,
+ std::vector<mcIdType*>& nodeglobal,
+ std::vector<mcIdType*>& faceglobal)
{
- _nb_domain=meshes.size();
- int index_global=0;
- int index_node_global=0;
- int index_face_global=0;
+ _nb_domain=(int)meshes.size();
+ mcIdType index_global=0;
+ mcIdType index_node_global=0;
+ mcIdType index_face_global=0;
_nb_cells.resize(_nb_domain);
_nb_nodes.resize(_nb_domain);
{
//int cellDomainShift=_cell_shift_by_domain[idomain];
//creating global numbering from scratch
- for (int i=0; i<_nb_cells[idomain]; i++)
+ for (mcIdType i=0; i<_nb_cells[idomain]; i++)
{
- int global=i ;//cellDomainShift+i;
+ mcIdType global=i ;//cellDomainShift+i;
_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_loc_to_glob[idomain][i]=global;
index_global++;
//using global numbering coming from a previous numbering
else
{
- for (int i=0; i<_nb_cells[idomain]; i++)
+ for (mcIdType i=0; i<_nb_cells[idomain]; i++)
{
- int global=cellglobal[idomain][i];
+ mcIdType global=cellglobal[idomain][i];
_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
//_loc_to_glob[make_pair(idomain,i+1)]=global;
_loc_to_glob[idomain][i]=global;
_nb_total_cells=index_global;
_nb_cells[0]=index_global;
_node_loc_to_glob[idomain].resize(meshes[idomain]->getNumberOfNodes());
- for (int i=0; i<meshes[idomain]->getNumberOfNodes(); i++)
+ for (mcIdType i=0; i<meshes[idomain]->getNumberOfNodes(); i++)
{
_node_glob_to_loc.insert(std::make_pair(i,std::make_pair(0,i)));
_node_loc_to_glob[0][i]=i;
//creating node maps
_nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes();
- INTERP_KERNEL::HashMap <int,std::pair<int,int> > local2distant;
+ INTERP_KERNEL::HashMap <mcIdType,std::pair<int,mcIdType> > local2distant;
_node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
for (std::size_t icz=0; icz<cz.size(); icz++)
{
int distant_ip = cz[icz]->getDistantDomainNumber();
for (mcIdType i=0; i< nb_node; i++)
{
- int local= node_corresp[i*2];
- int distant = node_corresp[i*2+1];
+ mcIdType local= node_corresp[i*2];
+ mcIdType distant = node_corresp[i*2+1];
local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant)));
}
}
// setting mappings for all nodes
if (nodeglobal[idomain]==0)
{
- for (int inode=0; inode<_nb_nodes[idomain]; inode++)
+ for (mcIdType inode=0; inode<_nb_nodes[idomain]; inode++)
{
if (local2distant.find(inode)==local2distant.end())
{
else
{
int ip = (local2distant.find(inode)->second).first;
- int distant = (local2distant.find(inode)->second).second;
- int global_number=_loc_to_glob[ip][distant];
+ mcIdType distant = (local2distant.find(inode)->second).second;
+ mcIdType global_number=_loc_to_glob[ip][distant];
_node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode)));
_node_loc_to_glob[idomain][inode]=global_number;
}
//using former node numbering
else
{
- for (int inode=0; inode<_nb_nodes[idomain]; inode++)
+ for (mcIdType inode=0; inode<_nb_nodes[idomain]; inode++)
{
- int global_number=nodeglobal[idomain][inode];
+ mcIdType global_number=nodeglobal[idomain][inode];
_node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode)));
_node_loc_to_glob[idomain][inode]=global_number;
}
int icellProc=0; //all cells of my domains are concatenated in part
for (int iold=0; iold<oldTopology->nbDomain(); iold++)
{
- int ioldNbCell=oldTopology->getCellNumber(iold);
+ mcIdType ioldNbCell=oldTopology->getCellNumber(iold);
//std::cout<<"proc "<<MyGlobals::_Rank<<" : cell number old domain "<<iold<<" : "<<ioldNbCell<<std::endl;
//if not my old domains getCellNumber is 0
- std::vector<int> globalids(ioldNbCell);
+ std::vector<mcIdType> globalids(ioldNbCell);
oldTopology->getCellList(iold, &globalids[0]); //unique global numerotation
- for (int icell=0; icell<ioldNbCell; icell++)
+ for (mcIdType icell=0; icell<ioldNbCell; icell++)
{
- int idomain=part[icellProc];
+ int idomain=FromIdType<int>(part[icellProc]);
_nb_cells[idomain]++;
icellProc++;
- int iGlobalCell=globalids[icell];
+ mcIdType iGlobalCell=globalids[icell];
_loc_to_glob[idomain].push_back(iGlobalCell);
_glob_to_loc.insert(std::make_pair(iGlobalCell, std::make_pair(idomain, _nb_cells[idomain])));
}
for ( mcIdType iGlob = 0; iGlob < nbCells; ++iGlob )
{
- int iGlobDom = part[ iGlob ];
- for ( int i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ )
+ int iGlobDom = FromIdType<int>(part[ iGlob ]);
+ for ( mcIdType i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ )
{
- int iGlobNear = value[ i ];
+ mcIdType iGlobNear = value[ i ];
if ( iGlob > iGlobNear )
continue; // treat ( iGlob, iGlobNear ) pair once
- int iGlobNearDom = part[ iGlobNear ];
+ int iGlobNearDom = FromIdType<int>(part[ iGlobNear ]);
if ( iGlobDom != iGlobNearDom )
{
- int iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt
- int iLocNear = convertGlobalCell( iGlobNear ).second - 1;
+ mcIdType iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt
+ mcIdType iLocNear = convertGlobalCell( iGlobNear ).second - 1;
cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLoc );
cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLocNear );
cellCorresp[ iGlobNearDom ][ iGlobDom ].push_back( iLocNear );
cz->setName( "Connect Zone defined by MEDPARTITIONER" );
cz->setDistantDomainNumber( idomainNear );
cz->setLocalDomainNumber ( idomain );
- cz->setEntityCorresp( 0,0, &corresp[0], corresp.size()/2 );
+ cz->setEntityCorresp( 0,0, &corresp[0], ToIdType( corresp.size()/2 ));
_connect_zones.push_back( cz );
}
}
* If a node in the list is represented on several domains,
* only the first value is returned
* */
-void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int* ip)
+void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int* ip)
{
if (_node_glob_to_loc.empty())
throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
- for (int i=0; i< nbnode; i++)
+ for (mcIdType i=0; i< nbnode; i++)
{
- std::pair<int,int> local_node = _node_glob_to_loc.find(node_list[i])->second;
+ std::pair<int,mcIdType> local_node = _node_glob_to_loc.find(node_list[i])->second;
ip[i]=local_node.first;
local[i]=local_node.second;
}
* only the value with domain ip is returned
*
* */
-void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int ip)
+void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int ip)
{
if (_node_glob_to_loc.empty())
throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
- for (int i=0; i< nbnode; i++)
+ for (mcIdType i=0; i< nbnode; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
* If a node in the list is represented on several domains,
* all the values are put in the array
* */
-void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int nbnode, int*& local, int*& ip,int*& full_array, int& size)
+void ParallelTopology::convertGlobalNodeListWithTwins(const mcIdType* node_list, mcIdType nbnode, mcIdType*& local, int*& ip,mcIdType*& full_array, mcIdType& size)
{
if (_node_glob_to_loc.empty())
throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
size=0;
- for (int i=0; i< nbnode; i++)
+ for (mcIdType i=0; i< nbnode; i++)
{
- int count= _node_glob_to_loc.count(node_list[i]);
+ mcIdType count= ToIdType( _node_glob_to_loc.count(node_list[i]));
size+=count;
}
- int index=0;
+ mcIdType index=0;
ip=new int[size];
- local=new int[size];
- full_array=new int[size];
- for (int i=0; i< nbnode; i++)
+ local=new mcIdType[size];
+ full_array=new mcIdType[size];
+ for (mcIdType i=0; i< nbnode; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
* If a face in the list is represented on several domains,
* all the values are put in the array
* */
-void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array,int& size)
+void ParallelTopology::convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size)
{
size=0;
- for (int i=0; i< nbface; i++)
+ for (mcIdType i=0; i< nbface; i++)
{
//int count = _face_glob_to_loc.count(face_list[i]);
//if (count >1) MESSAGE_MED("face en doublon "<<face_list[i]);
- size+= _face_glob_to_loc.count(face_list[i]);
+ size+= ToIdType(_face_glob_to_loc.count(face_list[i]));
}
- int index=0;
+ mcIdType index=0;
ip=new int[size];
- local=new int[size];
- full_array=new int[size];
- for (int i=0; i< nbface; i++)
+ local=new mcIdType[size];
+ full_array=new mcIdType[size];
+ for (mcIdType i=0; i< nbface; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
//!converts a list of global cell numbers
//!to a distributed array with local cell numbers
-void ParallelTopology::convertGlobalCellList(const int* cell_list, int nbcell, int* local, int* ip)
+void ParallelTopology::convertGlobalCellList(const mcIdType* cell_list, mcIdType nbcell, mcIdType* local, int* ip)
{
- for (int i=0; i<nbcell; i++)
+ for (mcIdType i=0; i<nbcell; i++)
{
- INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
+ INTERP_KERNEL::HashMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
if (iter == _glob_to_loc.end())
{
std::cerr << "proc " << MyGlobals::_Rank << " : KO cell_list[" << i << "] : " << cell_list[i] << std::endl;
/*!Converts a list of global face numbers
* to a distributed array with local face numbers
*/
-void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int* ip)
+void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int* ip)
{
- for (int i=0; i< nbface; i++)
+ for (mcIdType i=0; i< nbface; i++)
{
- INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _face_glob_to_loc.find(face_list[i]);
+ INTERP_KERNEL::HashMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter = _face_glob_to_loc.find(face_list[i]);
if (iter == _face_glob_to_loc.end())
{
throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalFaceList : Face not found");
* only the value with domain ip is returned
*
*/
-void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int ip)
+void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int ip)
{
- for (int i=0; i< nbface; i++)
+ for (mcIdType i=0; i< nbface; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
//replacing a table of global numbering with a table with local numberings
// type_connectivity contains global connectivity for each type in input
// type_connectivity contains local connectivity for each type in output
-void ParallelTopology::convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain)
+void ParallelTopology::convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain)
{
- for (int inode=0; inode<nbnodes; inode++)
+ for (mcIdType inode=0; inode<nbnodes; inode++)
{
// cout <<" inode :"<<inode<< " global = "<<type_connectivity[type][inode];
- int global = nodes[inode];
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ mcIdType global = nodes[inode];
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> >::iterator mmiter;
std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(global);
for (mmiter it=range.first; it !=range.second; it++)
{
/*!
* \brief Return max global face number
*/
-int ParallelTopology::getMaxGlobalFace() const
+mcIdType ParallelTopology::getMaxGlobalFace() const
{
- int max = 0;
+ mcIdType max = 0;
TGlob2LocsMap::const_iterator g_l_l = _face_glob_to_loc.begin();
for ( ; g_l_l != _face_glob_to_loc.end(); ++g_l_l )
if ( g_l_l->first > max )
return max;
}
-int ParallelTopology::getNodeNumber() const
+mcIdType ParallelTopology::getNodeNumber() const
{
if (_node_glob_to_loc.empty()) return 0;
- std::set <int> keys;
- for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _node_glob_to_loc.begin(); iter!=_node_glob_to_loc.end(); iter++)
+ std::set <mcIdType> keys;
+ for (INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter= _node_glob_to_loc.begin(); iter!=_node_glob_to_loc.end(); iter++)
{
keys.insert(iter->first);
}
- return keys.size();
+ return ToIdType(keys.size());
}
/*!
* retrieving list of nodes in global numbers
*/
-void ParallelTopology::getNodeList(int idomain, int *list) const
+void ParallelTopology::getNodeList(int idomain, mcIdType *list) const
{
- for (int i=0; i<_nb_nodes[idomain]; i++)
+ for (mcIdType i=0; i<_nb_nodes[idomain]; i++)
list[i]=_node_loc_to_glob[idomain][i];
}
/*!
* retrieving list of nodes in global numbers
*/
-void ParallelTopology::getCellList(int idomain, int *list) const
+void ParallelTopology::getCellList(int idomain, mcIdType *list) const
{
- for (int i=0; i<_nb_cells[idomain];i++)
+ for (mcIdType i=0; i<_nb_cells[idomain];i++)
list[i]=_loc_to_glob[idomain][i];
}
-int ParallelTopology::getFaceNumber() const
+mcIdType ParallelTopology::getFaceNumber() const
{
if (_face_glob_to_loc.empty())
return 0;
- std::set <int> keys;
- for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _face_glob_to_loc.begin(); iter!=_face_glob_to_loc.end(); iter++)
+ std::set <mcIdType> keys;
+ for (INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator iter= _face_glob_to_loc.begin(); iter!=_face_glob_to_loc.end(); iter++)
{
keys.insert(iter->first);
}
- return keys.size();
+ return ToIdType(keys.size());
}
/*!
* retrieving list of faces in global numbers
*/
-void ParallelTopology::getFaceList(int idomain, int *list) const
+void ParallelTopology::getFaceList(int idomain, mcIdType *list) const
{
- for (int i=0; i<_nb_faces[idomain];i++)
+ for (mcIdType i=0; i<_nb_faces[idomain];i++)
list[i]=_face_loc_to_glob[idomain][i];
}
-int ParallelTopology::convertGlobalFace(int iglobal, int idomain)
+mcIdType ParallelTopology::convertGlobalFace(mcIdType iglobal, int idomain)
{
- typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator MMiter;
std::pair<MMiter,MMiter> eq = _face_glob_to_loc.equal_range(iglobal);
for (MMiter it=eq.first; it != eq.second; it++)
if (it->second.first == idomain)
return -1;
}
-int ParallelTopology::convertGlobalNode(int iglobal, int idomain)
+mcIdType ParallelTopology::convertGlobalNode(mcIdType iglobal, int idomain)
{
- typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType, std::pair<int,mcIdType> >::const_iterator MMiter;
std::pair<MMiter,MMiter> eq = _node_glob_to_loc.equal_range(iglobal);
for (MMiter it=eq.first; it != eq.second; it++)
{
/*!
* adding a face to the topology
*/
-void ParallelTopology::appendFace(int idomain, int ilocal, int iglobal)
+void ParallelTopology::appendFace(int idomain, mcIdType ilocal, mcIdType iglobal)
{
_face_loc_to_glob[idomain].push_back(iglobal);
_face_glob_to_loc.insert(std::make_pair(iglobal,std::make_pair(idomain,ilocal)));
ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>&);
ParallelTopology(const std::vector<MEDCoupling::MEDCouplingUMesh*>&,
const std::vector<MEDPARTITIONER::ConnectZone*>&,
- std::vector<int*>&,
- std::vector<int*>&,
- std::vector<int*>&);
+ std::vector<mcIdType*>&,
+ std::vector<mcIdType*>&,
+ std::vector<mcIdType*>&);
ParallelTopology(Graph* graph, Topology* oldTopology, int nbdomain, int mesh_dimension);
~ParallelTopology();
/*! converts a list of global cell numbers
* to a distributed array with local cell numbers
*/
- void convertGlobalNodeList(const int*, int,int*,int*);
- void convertGlobalNodeList(const int*, int,int*,int);
- void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size);
+ void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int*);
+ void convertGlobalNodeList(const mcIdType*, mcIdType,mcIdType*,int);
+ void convertGlobalNodeListWithTwins(const mcIdType* face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size);
/*! converts a list of global node numbers
* to a distributed array with local cell numbers
*/
- void convertGlobalCellList(const int*, int , int*, int *);
+ void convertGlobalCellList(const mcIdType*, mcIdType , mcIdType*, int *);
/*! converts a list of global face numbers
* to a distributed array with local face numbers
*/
- void convertGlobalFaceList(const int*, int , int*, int *);
- void convertGlobalFaceList(const int*, int , int*, int);
- void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array,int& size);
+ void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int *);
+ void convertGlobalFaceList(const mcIdType*, mcIdType , mcIdType*, int);
+ void convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size);
/*! converting node global numberings to local numberings */
- void convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain);
+ void convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain);
/*! converting node local numbering to global */
- int convertNodeToGlobal(int ip, int icell) const { return _node_loc_to_glob[ip][icell]; }
+ mcIdType convertNodeToGlobal(int ip, mcIdType icell) const { return _node_loc_to_glob[ip][icell]; }
/*! converting face local numbering to global */
- int convertFaceToGlobal(int ip, int iface) const { return _face_loc_to_glob[ip][iface]; }
+ mcIdType convertFaceToGlobal(int ip, mcIdType iface) const { return _face_loc_to_glob[ip][iface]; }
/*! converting cell global numbering to local */
- int convertCellToGlobal(int ip, int icell) const { return _loc_to_glob[ip][icell]; }
+ mcIdType convertCellToGlobal(int ip, mcIdType icell) const { return _loc_to_glob[ip][icell]; }
- void convertNodeToGlobal(int ip, const int* local, int n, int *global) const
+ void convertNodeToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
global[i]=_node_loc_to_glob[ip][local[i]];
}
- void convertCellToGlobal(int ip, const int* local, int n, int *global) const
+ void convertCellToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
global[i]=_loc_to_glob[ip][local[i]];
}
- void convertFaceToGlobal(int ip, const int* local, int n, int *global) const
+ void convertFaceToGlobal(int ip, const mcIdType* local, mcIdType n, mcIdType *global) const
{
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
global[i]=_face_loc_to_glob[ip][local[i]];
}
int nbDomain() const { return _nb_domain; }
- int nbCells() const { return _nb_total_cells; }
+ mcIdType nbCells() const { return _nb_total_cells; }
- int nbNodes() const { return _nb_total_nodes; }
+ mcIdType nbNodes() const { return _nb_total_nodes; }
- int nbCells( int idomain) const { return _nb_cells[idomain]; }
+ mcIdType nbCells( int idomain) const { return _nb_cells[idomain]; }
/*! retrieving number of nodes */
- int getNodeNumber(int idomain) const { return _nb_nodes[idomain]; }
+ mcIdType getNodeNumber(int idomain) const { return _nb_nodes[idomain]; }
- int getNodeNumber() const;
+ mcIdType getNodeNumber() const;
- void getNodeList(int idomain, int* list) const;
+ void getNodeList(int idomain, mcIdType* list) const;
/*! retrieving cell numbers after merging in parallel mode */
- std::vector<int> & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; }
+ std::vector<mcIdType> & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; }
- const std::vector<int>& getFusedCellNumbers(int idomain) const { return _cell_loc_to_glob_fuse[idomain]; }
+ const std::vector<mcIdType>& getFusedCellNumbers(int idomain) const { return _cell_loc_to_glob_fuse[idomain]; }
/*! retrieving face numbers after merging in parallel mode */
- std::vector<int> & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; }
+ std::vector<mcIdType> & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; }
- const std::vector<int>& getFusedFaceNumbers(int idomain) const { return _face_loc_to_glob_fuse[idomain]; }
+ const std::vector<mcIdType>& getFusedFaceNumbers(int idomain) const { return _face_loc_to_glob_fuse[idomain]; }
/*! retrieving number of nodes */
- int getCellNumber(int idomain) const { return _nb_cells[idomain]; }
+ mcIdType getCellNumber(int idomain) const { return _nb_cells[idomain]; }
- int getCellDomainNumber(int global) const { return (_glob_to_loc.find(global)->second).first; }
+ mcIdType getCellDomainNumber(int global) const { return (_glob_to_loc.find(global)->second).first; }
- void getCellList(int idomain, int* list) const;
+ void getCellList(int idomain, mcIdType* list) const;
- int getFaceNumber(int idomain) const { return _nb_faces[idomain]; }
+ mcIdType getFaceNumber(int idomain) const { return _nb_faces[idomain]; }
- int getFaceNumber() const;
+ mcIdType getFaceNumber() const;
- void getFaceList(int idomain, int* list) const;
+ void getFaceList(int idomain, mcIdType* list) const;
/*! converting a global cell number to a local representation (domain + local number) */
- std::pair<int,int> convertGlobalCell(int iglobal) const { return _glob_to_loc.find(iglobal)->second; }
+ std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const { return _glob_to_loc.find(iglobal)->second; }
- int convertGlobalFace(int iglobal, int idomain);
+ mcIdType convertGlobalFace(mcIdType iglobal, int idomain);
- int convertGlobalNode(int iglobal, int idomain);
+ mcIdType convertGlobalNode(mcIdType iglobal, int idomain);
std::vector<MEDPARTITIONER::ConnectZone*>& getCZ();
//adding a face to the topology
- void appendFace(int idomain, int ilocal, int iglobal);
+ void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal);
//return max global face number
- int getMaxGlobalFace() const;
+ mcIdType getMaxGlobalFace() const;
private:
- bool hasCellWithNodes( const MeshCollection&, int dom, const std::set<int>& nodes );
+ bool hasCellWithNodes( const MeshCollection&, int dom, const std::set<mcIdType>& nodes );
private:
//mapping global -> local
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> > TGlob2DomainLoc;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2DomainLoc;
TGlob2DomainLoc _glob_to_loc;
TGlob2DomainLoc _node_glob_to_loc;
//mapping local -> global
- std::vector<std::vector<int> > _loc_to_glob;
- std::vector<std::vector <int> > _node_loc_to_glob;
+ std::vector<std::vector<mcIdType> > _loc_to_glob;
+ std::vector<std::vector <mcIdType> > _node_loc_to_glob;
// global numbers in parallel mode
- std::vector<std::vector <int> > _cell_loc_to_glob_fuse; // glob nums after merging
- std::vector<std::vector <int> > _face_loc_to_glob_fuse; // glob nums after merging
+ std::vector<std::vector <mcIdType> > _cell_loc_to_glob_fuse; // glob nums after merging
+ std::vector<std::vector <mcIdType> > _face_loc_to_glob_fuse; // glob nums after merging
//mapping global -> local
- typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> > TGlob2LocsMap;
+ typedef INTERP_KERNEL::HashMultiMap<mcIdType,std::pair<int,mcIdType> > TGlob2LocsMap;
TGlob2LocsMap _face_glob_to_loc;
//mapping local -> global
- std::vector<std::vector <int> > _face_loc_to_glob;
- std::vector<int> _nb_cells;
- std::vector<int> _nb_nodes;
- std::vector<int> _nb_faces;
- int _nb_total_cells;
- int _nb_total_nodes;
- int _nb_total_faces;
+ std::vector<std::vector <mcIdType> > _face_loc_to_glob;
+ std::vector<mcIdType> _nb_cells;
+ std::vector<mcIdType> _nb_nodes;
+ std::vector<mcIdType> _nb_faces;
+ mcIdType _nb_total_cells;
+ mcIdType _nb_total_nodes;
+ mcIdType _nb_total_faces;
int _nb_domain;
int _mesh_dimension;
std::cout << "proc " << MyGlobals::_Rank << " : SCOTCHGraph::partGraph" << std::endl;
//number of graph vertices
- int n = _graph->getNumberOf();
+ int n = FromIdType<int>(_graph->getNumberOf());
//graph
#ifdef MEDCOUPLING_USE_64BIT_IDS
std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
#define __MEDPARTITIONER_TOPOLOGY_HXX__
#include "MEDPARTITIONER.hxx"
+#include "MCType.hxx"
#include <map>
#include <vector>
/*! converts a list of global cell numbers
* to a distributed array with local cell numbers
*/
- virtual void convertGlobalNodeList(const int *list, int nb, int *local, int*ip) = 0;
- virtual void convertGlobalNodeList(const int *list, int nb, int *local, int ip) = 0;
+ virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *local, int*ip) = 0;
+ virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *local, int ip) = 0;
//converts a list of global node numbers
/*! to a distributed array with local cell numbers */
- virtual void convertGlobalCellList(const int*list , int nb, int *local, int*ip) = 0;
+ virtual void convertGlobalCellList(const mcIdType*list , mcIdType nb, mcIdType *local, int*ip) = 0;
/*! converts a list of global face numbers
* to a distributed array with local face numbers
*/
- virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip) = 0;
- virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip) = 0;
- virtual void convertGlobalFaceListWithTwins(const int *face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size) = 0;
- virtual void convertGlobalNodeListWithTwins(const int *face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size) = 0;
+ virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int*ip) = 0;
+ virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int ip) = 0;
+ virtual void convertGlobalFaceListWithTwins(const mcIdType *face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0;
+ virtual void convertGlobalNodeListWithTwins(const mcIdType *face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0;
/*! number of doamins */
virtual int nbDomain() const = 0;
/*! number of cells */
- virtual int nbCells() const = 0;
+ virtual mcIdType nbCells() const = 0;
/*! number of nodes */
- virtual int nbNodes() const = 0;
+ virtual mcIdType nbNodes() const = 0;
/*! number of cells on a specific domain */
- virtual int nbCells(int idomain) const = 0;
+ virtual mcIdType nbCells(int idomain) const = 0;
/*! converting node global numberings to local numberings */
- virtual void convertToLocal2ndVersion(int*,int,int) = 0;
- virtual int convertNodeToGlobal(int ip,int icell) const = 0;
- virtual int convertFaceToGlobal(int ip,int icell) const = 0;
- virtual int convertCellToGlobal(int ip,int icell) const = 0;
- virtual void convertNodeToGlobal(int ip,const int *local, int n, int *global) const = 0;
- virtual void convertCellToGlobal(int ip,const int *local, int n, int *global) const = 0;
- virtual void convertFaceToGlobal(int ip,const int *local, int n, int *global) const = 0;
+ virtual void convertToLocal2ndVersion(mcIdType*,mcIdType,int) = 0;
+ virtual mcIdType convertNodeToGlobal(int ip,mcIdType icell) const = 0;
+ virtual mcIdType convertFaceToGlobal(int ip,mcIdType icell) const = 0;
+ virtual mcIdType convertCellToGlobal(int ip,mcIdType icell) const = 0;
+ virtual void convertNodeToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
+ virtual void convertCellToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
+ virtual void convertFaceToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0;
/*! retrieving number of nodes */
- virtual int getNodeNumber(int idomain) const = 0;
- virtual int getNodeNumber() const = 0;
+ virtual mcIdType getNodeNumber(int idomain) const = 0;
+ virtual mcIdType getNodeNumber() const = 0;
/*! retrieving list of nodes */
- virtual void getNodeList(int idomain, int *list) const = 0;
- virtual std::vector<int> & getFusedCellNumbers(int idomain) = 0;
- virtual const std::vector<int> & getFusedCellNumbers(int idomain) const = 0;
- virtual std::vector<int> & getFusedFaceNumbers(int idomain) = 0;
- virtual const std::vector<int> & getFusedFaceNumbers(int idomain) const = 0;
+ virtual void getNodeList(int idomain, mcIdType *list) const = 0;
+ virtual std::vector<mcIdType> & getFusedCellNumbers(int idomain) = 0;
+ virtual const std::vector<mcIdType> & getFusedCellNumbers(int idomain) const = 0;
+ virtual std::vector<mcIdType> & getFusedFaceNumbers(int idomain) = 0;
+ virtual const std::vector<mcIdType> & getFusedFaceNumbers(int idomain) const = 0;
/*! retrieving number of nodes */
- virtual int getCellNumber(int idomain) const = 0;
+ virtual mcIdType getCellNumber(int idomain) const = 0;
/*! retrieving list of nodes */
- virtual void getCellList(int idomain, int *list) const = 0;
+ virtual void getCellList(int idomain, mcIdType *list) const = 0;
/*! retrieving number of faces */
- virtual int getFaceNumber(int idomain) const = 0;
- virtual int getFaceNumber() const = 0;
+ virtual mcIdType getFaceNumber(int idomain) const = 0;
+ virtual mcIdType getFaceNumber() const = 0;
/*! retrieving list of nodes */
- virtual void getFaceList(int idomain, int *list) const = 0;
+ virtual void getFaceList(int idomain, mcIdType *list) const = 0;
/*! adding a face to the mapping */
- virtual void appendFace(int idomain, int ilocal, int iglobal) = 0;
+ virtual void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal) = 0;
/*! returns max global face number */
- virtual int getMaxGlobalFace() const = 0;
+ virtual mcIdType getMaxGlobalFace() const = 0;
/*! converting a global cell number to a local representation */
- virtual std::pair<int,int> convertGlobalCell(int iglobal) const = 0;
+ virtual std::pair<int,mcIdType> convertGlobalCell(mcIdType iglobal) const = 0;
/*! converting a global face number to a local representation */
- virtual int convertGlobalFace(int iglobal, int idomain) = 0;
+ virtual mcIdType convertGlobalFace(mcIdType iglobal, int idomain) = 0;
/*! converting a global node number to a local representation */
- virtual int convertGlobalNode(int iglobal, int idomain) = 0;
+ virtual mcIdType convertGlobalNode(mcIdType iglobal, int idomain) = 0;
/*! getting a reference to connect zones vector */
virtual std::vector<MEDPARTITIONER::ConnectZone*>& getCZ() = 0;
};
* (domain numbers range from 0 to ndomain-1
* \param n number of cells in the mesh
*/
-UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const mcIdType *partition, mcIdType n):Graph(array,0)
+UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,0)
{
std::vector<mcIdType> index(n+1),value(n);
class MEDPARTITIONER_EXPORT UserGraph : public Graph
{
public:
- UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const mcIdType*, mcIdType);
+ UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const int*, mcIdType);
virtual ~UserGraph();
void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=0);
};
std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl;
return;
}
- int size=ran.size();
+ std::size_t size=ran.size();
std::vector<int> invran(size);
- for (int i=0; i<size; i++)
+ for (unsigned int i=0; i<size; i++)
invran[ran[i]]=i;
vx.resize(size+1);
int lga=xadj[size];
va.resize(lga);
int jj=0;
vx[0]=0;
- for (int i=0; i<size; i++)
+ for (std::size_t i=0; i<size; i++)
{
int ir=ran[i];
int ii=xadj[ir];
return oss.str();
}
-std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,int>& mymap)
+std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,mcIdType>& mymap)
{
if (mymap.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (std::map<std::string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl;
return oss.str();
}
* elements first and second of map give one elements in result vector of string
* converting formatted the int second as firsts characters ending at first slash
*/
-std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,int>& mymap)
+std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,mcIdType>& mymap)
{
std::vector<std::string> res;
- for (std::map<std::string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
{
std::ostringstream oss;
oss << (*i).second << "/" << (*i).first;
/*
* if existing identicals (first,second) in vector no problem, else Exception
*/
-std::map<std::string,int> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
+std::map<std::string,mcIdType> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
{
- std::map<std::string,int> res;
+ std::map<std::string,mcIdType> res;
for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
std::size_t pos=0;
std::size_t found=(*i).find('/'); //first slash
if ((found==std::string::npos) || (found<1))
throw INTERP_KERNEL::Exception("Error aIntNumber/anyString is expected");
- int second;
+ mcIdType second;
std::istringstream iss((*i).substr(pos,found));
iss >> second;
std::string first=(*i).substr(pos+found+1,posmax-found);
- std::map<std::string,int>::iterator it=res.find(first);
+ std::map<std::string,mcIdType>::iterator it=res.find(first);
if (it!=res.end())
if ((*it).second!=second)
throw INTERP_KERNEL::Exception("Error not the same map value");
std::vector<std::string> res;
if (fd->getArray())
{
- int nb=fd->getArray()->getNumberOfComponents();
- res.push_back("nbComponents="); res.back()+=IntToStr(nb);
- for (int i=0; i<nb; i++)
+ std::size_t nb=fd->getArray()->getNumberOfComponents();
+ res.push_back("nbComponents="); res.back()+=IntToStr((int)nb);
+ for (unsigned int i=0; i<nb; i++)
{
res.push_back("componentInfo");
res.back()+=IntToStr(i)+"="+fd->getArray()->getInfoOnComponent(i);
return res;
}
+MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > MEDPARTITIONER::FromIdTypeVec( const std::vector< mcIdType >& vec )
+{
+ MEDCoupling::DataArrayInt32* array = MEDCoupling::DataArrayInt32::New();
+ array->alloc( vec.size(), 1 );
+ std::copy( vec.begin(), vec.end(), array->getPointer() );
+ return array;
+}
+
+
/*!
* quick almost human readable information on all fields on a mesh in a .med file
*/
namespace MEDPARTITIONER
{
- BBTreeOfDim::BBTreeOfDim( int dim,
+ BBTreeOfDim::BBTreeOfDim( std::size_t dim,
const double* bbs,
- int* elems,
+ mcIdType* elems,
int level,
- int nbelems,
+ mcIdType nbelems,
double epsilon)
{
switch ( dim )
{
case 3:
- _tree=new BBTree<3> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<3,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 3 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 3 >;
break;
case 2:
- _tree=new BBTree<2> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<2,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 2 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 2 >;
break;
case 1:
- _tree=new BBTree<1> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<1,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 1 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >;
break;
}
void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr,
- std::vector<int>& elems ) const
+ std::vector<mcIdType>& elems ) const
{
BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetElementsAroundPoint) ( coordsPtr, elems );
}
void BBTreeOfDim::getIntersectingElems(const double* bb,
- std::vector<int>& elems) const
+ std::vector<mcIdType>& elems) const
{
BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetIntersectingElems) ( bb, elems );
MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector<std::string>& vec);
MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector<std::string>& vec, const std::string separator);
- MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map<std::string,int>& mymap);
+ MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map<std::string,mcIdType>& mymap);
MEDPARTITIONER_EXPORT std::string ReprMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap);
MEDPARTITIONER_EXPORT std::string ReprFieldDescriptions(const std::vector<std::string>& vec,const std::string separator);
MEDPARTITIONER_EXPORT std::vector<std::string> DeserializeToVectorOfString(const std::string& str);
MEDPARTITIONER_EXPORT std::string EraseTagSerialized(const std::string& fromStr, const std::string& tag);
- MEDPARTITIONER_EXPORT std::vector<std::string> VectorizeFromMapOfStringInt(const std::map<std::string,int>& mymap);
- MEDPARTITIONER_EXPORT std::map<std::string,int> DevectorizeToMapOfStringInt(const std::vector<std::string>& vec);
+ MEDPARTITIONER_EXPORT std::vector<std::string> VectorizeFromMapOfStringInt(const std::map<std::string,mcIdType>& mymap);
+ MEDPARTITIONER_EXPORT std::map<std::string,mcIdType> DevectorizeToMapOfStringInt(const std::vector<std::string>& vec);
MEDPARTITIONER_EXPORT std::vector<std::string> VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap);
MEDPARTITIONER_EXPORT std::map< std::string,std::vector<std::string> > DevectorizeToMapOfStringVectorOfString(const std::vector<std::string>& vec);
int& idomain, std::string& fileName, std::string& meshName, std::string& fieldName,
int& typeField, int& DT, int& IT);
MEDPARTITIONER_EXPORT void FieldShortDescriptionToData(const std::string& description,
- std::string& fieldName, int& typeField, int& entity, int& DT, int& IT);
-
+ std::string& fieldName, int& typeField, int& entity, int& DT, int& IT);
+
MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector<mcIdType>& v);
MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector<mcIdType>& v, const int nbComponents);
MEDCoupling::DataArrayDouble *CreateDataArrayDoubleFromVector(const std::vector<double>& v);
std::vector<std::string> BrowseAllFieldsOnMesh(const std::string& myfile, const std::string& mymesh, const int idomain);
std::vector<std::string> GetInfosOfField(const char *fileName, const char *meshName, const int idomain );
+ MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > FromIdTypeVec( const std::vector< mcIdType >& vec );
+
+
#ifdef HAVE_MPI
//not advised, interblocking, use sendAndReceive
//void SendVectorOfString(const std::vector<std::string>& vec, const int target);
std::vector<double> *RecvDoubleVec(const int source);
void RecvDoubleVec(std::vector<double>& vec, const int source);
- void SendIntVec(const std::vector<int>& vec, const int target);
+ void SendIntVec(const std::vector<mcIdType>& vec, const int target);
std::vector<int>* RecvIntVec(int source);
- void RecvIntVec(std::vector<int>& vec, const int source);
+ void RecvIntVec(std::vector<mcIdType>& vec, const int source);
void SendDataArrayInt(const MEDCoupling::DataArrayInt* da, const int target);
MEDCoupling::DataArrayInt *RecvDataArrayInt(const int source);
{
void * _tree;
void (BBTreeOfDim::*_PgetElementsAroundPoint)( const double* coordsPtr,
- std::vector<int>& elems ) const;
+ std::vector<mcIdType>& elems ) const;
void (BBTreeOfDim::*_PgetIntersectingElems)( const double* bb,
- std::vector<int>& elems ) const;
+ std::vector<mcIdType>& elems ) const;
template< int dim>
void _getElementsAroundPoint( const double* coordsPtr,
- std::vector<int>& elems ) const
+ std::vector<mcIdType>& elems ) const
{
- ((BBTree<dim,int>*)_tree)->getElementsAroundPoint( coordsPtr, elems );
+ ((BBTree<dim,mcIdType>*)_tree)->getElementsAroundPoint( coordsPtr, elems );
}
template< int dim>
void _getIntersectingElems(const double* bb,
- std::vector<int>& elems) const
+ std::vector<mcIdType>& elems) const
{
- ((BBTree<dim,int>*)_tree)->getIntersectingElems( bb, elems );
+ ((BBTree<dim,mcIdType>*)_tree)->getIntersectingElems( bb, elems );
}
public:
- BBTreeOfDim( int dim,
+ BBTreeOfDim( std::size_t dim,
const double* bbs,
- int* elems,
+ mcIdType* elems,
int level,
- int nbelems,
+ mcIdType nbelems,
double epsilon=1e-12);
~BBTreeOfDim();
- void getElementsAroundPoint(const double* coordsPtr, std::vector<int>& elems ) const;
- void getIntersectingElems (const double* bb, std::vector<int>& elems) const;
+ void getElementsAroundPoint(const double* coordsPtr, std::vector<mcIdType>& elems ) const;
+ void getIntersectingElems (const double* bb, std::vector<mcIdType>& elems) const;
};
}
#endif
#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelException.hxx"
#include "MCAuto.hxx"
+#include "MEDCouplingMemArray.txx"
#include "InterpKernelAutoPtr.hxx"
#include <fstream>
#include <string>
#ifdef HAVE_MPI
+
#include <mpi.h>
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+#define MPI_ID_TYPE MPI_INT
+#else
+#define MPI_ID_TYPE MPI_LONG
+#endif
+
#endif
using namespace MEDPARTITIONER;
if (rank == source)
{
std::string str=SerializeFromVectorOfString(vec);
- int size=str.length();
+ int size=(int)str.length();
MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD );
- MPI_Send( (void*)str.data(), str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD );
+ MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD );
}
int recSize=0;
std::string str=SerializeFromVectorOfString(vec);
std::vector<int> indexes(world_size);
- int size=str.length();
+ int size=(int)str.length();
MPI_Allgather(&size, 1, MPI_INT,
&indexes[0], 1, MPI_INT, MPI_COMM_WORLD);
for (int i=0; i<world_size; i++) disp.push_back( disp.back() + indexes[i] );
std::string recData(disp.back(),'x');
- MPI_Allgatherv((void*)str.data(), str.length(), MPI_CHAR,
+ MPI_Allgatherv((void*)str.data(), (int)str.length(), MPI_CHAR,
(void*)recData.data(), &indexes[0], &disp[0], MPI_CHAR,
MPI_COMM_WORLD);
void MEDPARTITIONER::SendDoubleVec(const std::vector<double>& vec, const int target)
{
int tag = 111002;
- int size=vec.size();
+ int size=(int)vec.size();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl;
#ifdef HAVE_MPI
\param vec vector to be sent
\param target processor id of the target
*/
-void MEDPARTITIONER::SendIntVec(const std::vector<int>& vec, const int target)
+void MEDPARTITIONER::SendIntVec(const std::vector<mcIdType>& vec, const int target)
{
int tag = 111003;
- int size=vec.size();
+ int size=(int)vec.size();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl;
#ifdef HAVE_MPI
- MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD);
- MPI_Send(const_cast<int*>(&vec[0]), size,MPI_INT, target, tag+100, MPI_COMM_WORLD);
+ MPI_Send(&size, 1, MPI_ID_TYPE, target, tag, MPI_COMM_WORLD);
+ MPI_Send(const_cast<mcIdType*>(&vec[0]), size,MPI_ID_TYPE, target, tag+100, MPI_COMM_WORLD);
#endif
}
return vec;
}
-void MEDPARTITIONER::RecvIntVec(std::vector<int>& vec, const int source)
+void MEDPARTITIONER::RecvIntVec(std::vector<mcIdType>& vec, const int source)
{
int tag = 111003;
int size;
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvIntVec " << size << std::endl;
vec.resize(size);
- MPI_Recv(&vec[0], size, MPI_INT, source, tag+100, MPI_COMM_WORLD,&status);
+ MPI_Recv(&vec[0], size, MPI_ID_TYPE, source, tag+100, MPI_COMM_WORLD,&status);
#endif
}
throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL");
int tag = 111004;
int size[3];
- size[0]=da->getNbOfElems();
- size[1]=da->getNumberOfTuples();
- size[2]=da->getNumberOfComponents();
+ size[0]=(int)da->getNbOfElems();
+ size[1]=(int)da->getNumberOfTuples();
+ size[2]=(int)da->getNumberOfComponents();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayInt " << size[0] << std::endl;
#ifdef HAVE_MPI
throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL");
int tag = 111005;
int size[3];
- size[0]=da->getNbOfElems();
- size[1]=da->getNumberOfTuples();
- size[2]=da->getNumberOfComponents();
+ size[0]=(int)da->getNbOfElems();
+ size[1]=(int)da->getNumberOfTuples();
+ size[2]=(int)da->getNumberOfComponents();
if (MyGlobals::_Verbose>1000)
std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayDouble " << size[0] << std::endl;
#ifdef HAVE_MPI
void MEDPARTITIONER::TestMapOfStringIntMpi()
{
int rank=MyGlobals::_Rank;
- std::map<std::string,int> myMap;
+ std::map<std::string,mcIdType> myMap;
myMap["one"]=1;
myMap["two"]=22; //a bug
myMap["three"]=3;
if (rank==0)
{
std::vector<std::string> v2=VectorizeFromMapOfStringInt(myMap);
- std::map<std::string,int> m3=DevectorizeToMapOfStringInt(v2);
+ std::map<std::string,mcIdType> m3=DevectorizeToMapOfStringInt(v2);
if (ReprMapOfStringInt(m3)!=ReprMapOfStringInt(myMap))
throw INTERP_KERNEL::Exception("Problem in (de)vectorize MapOfStringInt");
}
{
std::cout << "v2 is : a vector of size " << v2.size() << std::endl;
std::cout << ReprVectorOfString(v2) << std::endl;
- std::map<std::string,int> m2=DevectorizeToMapOfStringInt(v2);
+ std::map<std::string,mcIdType> m2=DevectorizeToMapOfStringInt(v2);
std::cout << "m2 is : a map of size " << m2.size() << std::endl;
std::cout << ReprMapOfStringInt(m2) << std::endl;
}
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(3);
- mcIdType nbc=conn.size()/8; //nb of cells
- mcIdType nbv=coor.size()/3; //nb of vertices
- mesh->allocateCells(nbc);
- for(mcIdType i=0; i<nbc; i++)
+ std::size_t nbc=conn.size()/8; //nb of cells
+ std::size_t nbv=coor.size()/3; //nb of vertices
+ mesh->allocateCells(ToIdType(nbc));
+ for(std::size_t i=0; i<nbc; i++)
{
mcIdType onehexa[8];
std::copy(conn.begin()+i*8,conn.begin()+(i+1)*8,onehexa);
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
- int nbc=conn.size()/4; //nb of cells
- int nbv=coor.size()/3; //nb of vertices
- mesh->allocateCells(nbc);
- for(int i=0; i<nbc; i++)
+ std::size_t nbc=conn.size()/4; //nb of cells
+ std::size_t nbv=coor.size()/3; //nb of vertices
+ mesh->allocateCells(ToIdType(nbc));
+ for(std::size_t i=0; i<nbc; i++)
{
mcIdType onequa[4];
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
- int nbc=conn.size()/4; //nb of cells
- int nbv=coor.size()/3; //nb of vertices
- mesh->allocateCells(nbc);
- for(int i=0; i<nbc; i++)
+ std::size_t nbc=conn.size()/4; //nb of cells
+ std::size_t nbv=coor.size()/3; //nb of vertices
+ mesh->allocateCells(ToIdType(nbc));
+ for(std::size_t i=0; i<nbc; i++)
{
mcIdType onequa[4];
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
}
MEDCouplingUMesh *mesh=ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setDescription("DescriptionOfFieldOnCells"); //not saved in file?
}
MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0);
- int nbOfNodes=mesh->getNumberOfNodes();
+ mcIdType nbOfNodes=mesh->getNumberOfNodes();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VectorFieldOnNodes");
f1->setDescription("DescriptionOfFieldOnNodes"); //not saved in file?
DataArrayDouble* coords=mesh->getCoords();
//int nbOfComp=coords->getNumberOfComponents(); //be 3D
- int nbOfTuple=coords->getNumberOfTuples();
+ mcIdType nbOfTuple=coords->getNumberOfTuples();
double* ptr=coords->getPointer();
double* ptrini=ptrInit;
- for (int i=0; i<nbOfTuple; i++)
+ for (mcIdType i=0; i<nbOfTuple; i++)
{
*ptr=(*ptrini)+dx; ptr++; ptrini++; //be 3D
*ptr=(*ptrini)+dy; ptr++; ptrini++;
//more nbptgauss=8 by default needs set MEDCouplingFieldDiscretizationPerCell
//theory: (may be) http://www.code-aster.org/V2/doc/v9/fr/man_r/r3/r3.06.03.pdf
int nbptgauss=8; //nb pt de gauss by cell
- int nbcell=f3->getMesh()->getNumberOfCells();
- int nb=nbcell*nbptgauss;
+ mcIdType nbcell=f3->getMesh()->getNumberOfCells();
+ mcIdType nb=nbcell*nbptgauss;
int nbcomp=2;
array->alloc(nb,nbcomp);
double *ptr=array->getPointer();
CPPUNIT_ASSERT(collection.getName()=="testMesh");
CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfLocalMeshes());
CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfGlobalMeshes());
- CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk,collection.getNbOfLocalCells());
- CPPUNIT_ASSERT_EQUAL(_ni*_nj,collection.getNbOfLocalFaces());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk),collection.getNbOfLocalCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj),collection.getNbOfLocalFaces());
}
void MEDPARTITIONERTest::testMeshCollectionXml()
CPPUNIT_ASSERT(collection.getName()=="testMesh");
CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfLocalMeshes());
CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfGlobalMeshes());
- CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk*8,collection.getNbOfLocalCells());
- CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk*8),collection.getNbOfLocalCells());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces());
}
CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh();
CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size());
- int nbcells=0;
+ mcIdType nbcells=0;
for (std::size_t i = 0; i < cellMeshes.size(); i++)
nbcells+=cellMeshes[i]->getNumberOfCells();
- CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
+ CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
std::vector<MEDCoupling::MEDCouplingUMesh*>faceMeshes=collection.getFaceMesh();
CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size());
- int nbfaces=0;
+ mcIdType nbfaces=0;
for (std::size_t i=0; i < faceMeshes.size(); i++)
nbfaces+=faceMeshes[i]->getNumberOfCells();
- CPPUNIT_ASSERT_EQUAL((int)faceMesh->getNumberOfCells(), nbfaces);
+ CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces);
//merge split meshes and test equality
cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch; //on same proc
MCAuto<MEDCouplingField> field2Tmp(ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1));
MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
- int nbcells=corr[1]->getNumberOfTuples();
- CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
+ mcIdType nbcells=corr[1]->getNumberOfTuples();
+ CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
//use corr to test equality of field
DataArrayDouble* f1=field1->getArray();
DataArrayDouble* f2=field2->getArray();
}
int nbequal=0;
- int nbcomp=field1->getNumberOfComponents();
+ std::size_t nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- mcIdType i1=pc[i]*nbcomp;
- int i2=i*nbcomp;
- for (int j = 0; j < nbcomp; j++)
+ std::size_t i1=pc[i]*nbcomp;
+ std::size_t i2=i*nbcomp;
+ for (std::size_t j = 0; j < nbcomp; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
//cout<<" "<<p1[i1+j]<<"="<<p2[i2+j];
}
}
- CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal);
+ CPPUNIT_ASSERT_EQUAL((int)(nbcells*nbcomp), nbequal);
for (std::size_t i = 0; i < corr.size(); i++)
corr[i]->decrRef();
MCAuto<MEDCouplingField> field2Tmp=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
- int nbcells=corr[1]->getNumberOfTuples();
- CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
+ mcIdType nbcells=corr[1]->getNumberOfTuples();
+ CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
//use corr to test equality of field
DataArrayDouble* f1=field1->getArray();
DataArrayDouble* f2=field2->getArray();
}
int nbequal=0;
int nbptgauss=8;
- int nbcomp=field1->getNumberOfComponents();
+ std::size_t nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- mcIdType i1=pc[i]*nbcomp*nbptgauss;
- int i2=i*nbcomp*nbptgauss;
- for (int j = 0; j < nbcomp*nbptgauss; j++)
+ std::size_t i1=pc[i]*nbcomp*nbptgauss;
+ std::size_t i2=i*nbcomp*nbptgauss;
+ for (std::size_t j = 0; j < nbcomp*nbptgauss; j++)
{
if (p1[i1+j]==p2[i2+j]) nbequal++;
//cout<<" "<<p1[i1+j]<<"="<<p2[i2+j];
}
}
- CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal);
+ CPPUNIT_ASSERT_EQUAL((int)(nbcells*nbcomp*nbptgauss), nbequal);
for (std::size_t i = 0; i < corr.size(); i++)
corr[i]->decrRef();
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
- nbc=conn.size()/4; //nb of cells
+ nbc=(int)conn.size()/4; //nb of cells
mesh->allocateCells(nbc);
mcIdType* pConn = &conn[0];
for(int i=0; i<nbc; i++, pConn+=4)
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,pConn);
mesh->finishInsertingCells();
- int nbv=coor.size()/2; //nb of vertices
+ int nbv=(int)coor.size()/2; //nb of vertices
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->useArray( &coor[0], /*ownership=*/false, DeallocType::CPP_DEALLOC, nbv, 2 );
mesh->setCoords(myCoords);
CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes());
CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes());
CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells());
- CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces());
CPPUNIT_ASSERT (new_collection.getNbOfLocalFaces() > 0 );
MyGlobals::_General_Informations.clear();
// Check that "groups and family handling is NOT bugged"
MeshCollection new_collection(std::string(xmlName)+".xml");
- std::map< int, int > famId2nb; // count total nb of cells in divided families
- std::map< int, int >::iterator id2nn;
+ std::map< mcIdType, int > famId2nb; // count total nb of cells in divided families
+ std::map< mcIdType, int >::iterator id2nn;
{
const std::vector<MEDCoupling::DataArrayIdType*>& famIdsVec = new_collection.getCellFamilyIds();
for ( size_t i = 0; i < famIdsVec.size(); ++i )
{
MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
- for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
+ for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
{
id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
id2nn->second++;
for ( size_t i = 0; i < famIdsVec.size(); ++i )
{
MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
- for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
+ for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
{
id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
id2nn->second++;
// of the same size
std::map<std::string,mcIdType>& famName2id = new_collection.getFamilyInfo();
std::map<std::string,mcIdType>::iterator na2id = famName2id.begin(), na2id2;
- std::set< int > okFamIds;
+ std::set< mcIdType > okFamIds;
okFamIds.insert(0);
for ( ; na2id != famName2id.end(); ++na2id )
{
ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON)
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_FLAGS "-py3")
ADD_DEFINITIONS("-DHDF5_IS_PARALLEL")
ENDIF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL)
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
INCLUDE_DIRECTORIES(
${MPI_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS}
int meshDim, spaceDim, numberOfNodes;
std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes));
std::vector<INTERP_KERNEL::NormalizedCellType> types;
- std::vector<int> distrib;
+ std::vector<mcIdType> distrib;
for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it0=typesDistrib.begin();it0!=typesDistrib.end();it0++)
for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
{
types.push_back((*it1).first);
- int tmp[3];
+ mcIdType tmp[3];
DataArray::GetSlice(0,(*it1).second,1,iPart,nbOfParts,tmp[0],tmp[1]);
tmp[2]=1;
distrib.insert(distrib.end(),tmp,tmp+3);
*/
void ParaMEDLoader::WriteMasterFile(const char *fileName, const std::vector<std::string>& fileNames, const char *meshName)
{
- int nbOfDom=fileNames.size();
+ std::size_t nbOfDom=fileNames.size();
std::ofstream fs(fileName);
fs << "#MED Fichier V 2.3" << " " << std::endl;
fs << "#"<<" " << std::endl;
fs << nbOfDom <<" " << std::endl;
- for(int i=0;i<nbOfDom;i++)
+ for(std::size_t i=0;i<nbOfDom;i++)
fs << meshName << " " << i+1 << " " << meshName << "_" << i+1 << " localhost " << fileNames[i] << " " << std::endl;
}
BlockTopology::BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid):
_dimension(grid->getSpaceDimension()), _proc_group(&group), _owns_processor_group(false)
{
- vector <int> axis_length(_dimension);
+ vector <mcIdType> axis_length(_dimension);
_nb_elems=1;
for (int idim=0; idim <_dimension; idim++)
{
_proc_group=geom_topo.getProcGroup();
_local_array_indices=geom_topo._local_array_indices;
vector<int> comp_indices = *(comp_topo.getBlockIndices());
- _local_array_indices.push_back(comp_indices);
+ _local_array_indices.emplace_back( comp_indices.begin(), comp_indices.end() );
_nb_procs_per_dim=geom_topo._nb_procs_per_dim;
_nb_procs_per_dim.push_back(comp_topo.nbBlocks());
_cycle_type=geom_topo._cycle_type;
* to \a group will cause an MPI error, while calling from a subset
* of \a group will result in a deadlock.
*/
- BlockTopology::BlockTopology(const ProcessorGroup& group, int nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false)
+ BlockTopology::BlockTopology(const ProcessorGroup& group, mcIdType nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false)
{
- int* nbelems_per_proc = new int[group.size()];
+ mcIdType* nbelems_per_proc = new mcIdType[group.size()];
const MPIProcessorGroup* mpi_group=dynamic_cast<const MPIProcessorGroup*>(_proc_group);
const MPI_Comm* comm=mpi_group->getComm();
- int nbtemp=nb_elem;
- mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_INT,
- nbelems_per_proc, 1, MPI_INT,
+ mcIdType nbtemp=nb_elem;
+ mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_ID_TYPE,
+ nbelems_per_proc, 1, MPI_ID_TYPE,
*comm);
- _nb_elems=0;
+ _nb_elems=0;
//splitting along only dimension
_local_array_indices.resize(1);
}
//!converts a pair <subdomainid,local> to a global number
- std::pair<int,int> BlockTopology::globalToLocal(const int global) const
+ std::pair<int,mcIdType> BlockTopology::globalToLocal(const mcIdType global) const
{
int subdomain_id=0;
- int position=global;
- int size=_nb_elems;
- int size_procs=_proc_group->size();
- int increment=size;
- vector<int>axis_position(_dimension);
- vector<int>axis_offset(_dimension);
+ mcIdType position=global;
+ mcIdType size=_nb_elems;
+ std::size_t size_procs=_proc_group->size();
+ mcIdType increment=size;
+ vector<mcIdType>axis_position(_dimension);
+ vector<mcIdType>axis_offset(_dimension);
for (int idim=0; idim<_dimension; idim++)
{
- int axis_size=_local_array_indices[idim].size()-1;
- int axis_nb_elem=_local_array_indices[idim][axis_size];
+ std::size_t axis_size=_local_array_indices[idim].size()-1;
+ mcIdType axis_nb_elem=_local_array_indices[idim][axis_size];
increment=increment/axis_nb_elem;
- int proc_increment = size_procs/(axis_size);
- int axis_pos=position/increment;
+ int proc_increment = (int)(size_procs/axis_size);
+ mcIdType axis_pos=position/increment;
position=position%increment;
int iaxis=1;
while (_local_array_indices[idim][iaxis]<=axis_pos)
axis_position[idim]=axis_pos-_local_array_indices[idim][iaxis-1];
axis_offset[idim]=iaxis;
}
- int local=0;
- int local_increment=1;
+ mcIdType local=0;
+ mcIdType local_increment=1;
for (int idim=_dimension-1; idim>=0; idim--)
{
local+=axis_position[idim]*local_increment;
}
//!converts local number to a global number
- int BlockTopology::localToGlobal(const pair<int,int> local) const
+ mcIdType BlockTopology::localToGlobal(const pair<int,mcIdType> local) const
{
- int subdomain_id=local.first;
- int global=0;
- int loc=local.second;
- int increment=_nb_elems;
- int proc_increment=_proc_group->size();
- int local_increment=getNbLocalElements();
+ std::size_t subdomain_id=local.first;
+ mcIdType global=0;
+ mcIdType loc=local.second;
+ mcIdType increment=_nb_elems;
+ std::size_t proc_increment=_proc_group->size();
+ mcIdType local_increment=getNbLocalElements();
for (int idim=0; idim < _dimension; idim++)
{
- int axis_size=_local_array_indices[idim].size()-1;
- int axis_nb_elem=_local_array_indices[idim][axis_size];
+ std::size_t axis_size=_local_array_indices[idim].size()-1;
+ mcIdType axis_nb_elem=_local_array_indices[idim][axis_size];
increment=axis_nb_elem==0?0:increment/axis_nb_elem;
- proc_increment = proc_increment/(axis_size);
- int proc_axis=subdomain_id/proc_increment;
+ proc_increment = proc_increment/axis_size;
+ std::size_t proc_axis=subdomain_id/proc_increment;
subdomain_id=subdomain_id%proc_increment;
- int local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis];
+ mcIdType local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis];
local_increment = (local_axis_nb_elem==0)?0:(local_increment/local_axis_nb_elem);
- int iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis];
+ mcIdType iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis];
global+=increment*iaxis;
loc = (local_increment==0)?0:(loc%local_increment);
}
}
//Retrieves the local number of elements
- int BlockTopology::getNbLocalElements()const
+ mcIdType BlockTopology::getNbLocalElements()const
{
int position=_proc_group->myRank();
- int nb_elem = 1;
+ mcIdType nb_elem = 1;
int increment=1;
for (int i=_dimension-1; i>=0; i--)
{
increment *=_nb_procs_per_dim[i];
int idim=position%increment;
position=position/increment;
- int imin=_local_array_indices[i][idim];
- int imax=_local_array_indices[i][idim+1];
+ mcIdType imin=_local_array_indices[i][idim];
+ mcIdType imax=_local_array_indices[i][idim+1];
nb_elem*=(imax-imin);
}
return nb_elem;
* as a size and each pair <int,int> contains min and max. Indices
* range from min to max-1.
*/
- std::vector<std::pair<int,int> > BlockTopology::getLocalArrayMinMax() const
+ std::vector<std::pair<int,mcIdType> > BlockTopology::getLocalArrayMinMax() const
{
- vector<pair<int,int> > local_indices (_dimension);
+ vector<pair<int,mcIdType> > local_indices (_dimension);
int myrank=_proc_group->myRank();
int increment=1;
for (int i=_dimension-1; i>=0; i--)
{
increment *=_nb_procs_per_dim[i];
int idim=myrank%increment;
- local_indices[i].first=_local_array_indices[i][idim];
+ local_indices[i].first=(int)_local_array_indices[i][idim];
local_indices[i].second=_local_array_indices[i][idim+1];
cout << local_indices[i].first << " "<< local_indices[i].second<<endl;
}
/*! Serializes the data contained in the Block Topology
* for communication purposes*/
- void BlockTopology::serialize(int* & serializer, int& size) const
+ void BlockTopology::serialize(mcIdType* & serializer, mcIdType& size) const
{
- vector<int> buffer;
+ vector<mcIdType> buffer;
buffer.push_back(_dimension);
buffer.push_back(_nb_elems);
{
buffer.push_back(_nb_procs_per_dim[i]);
buffer.push_back(_cycle_type[i]);
- buffer.push_back(_local_array_indices[i].size());
- for (int j=0; j<(int)_local_array_indices[i].size(); j++)
+ buffer.push_back(ToIdType(_local_array_indices[i].size()));
+ for (std::size_t j=0; j<_local_array_indices[i].size(); j++)
buffer.push_back(_local_array_indices[i][j]);
}
//serializing the comm group
- int size_comm=_proc_group->size();
+ mcIdType size_comm=_proc_group->size();
buffer.push_back(size_comm);
MPIProcessorGroup world_group(_proc_group->getCommInterface());
for (int i=0; i<size_comm;i++)
buffer.push_back(world_rank);
}
- serializer=new int[buffer.size()];
- size=buffer.size();
+ serializer=new mcIdType[buffer.size()];
+ size=ToIdType(buffer.size());
copy(buffer.begin(), buffer.end(), serializer);
}
* after communication. Uses the same structure as the one used for serialize()
*
*/
- void BlockTopology::unserialize(const int* serializer,const CommInterface& comm_interface)
+ void BlockTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface)
{
- const int* ptr_serializer=serializer;
+ const mcIdType* ptr_serializer=serializer;
cout << "unserialize..."<<endl;
- _dimension=*(ptr_serializer++);
+ _dimension=(int)*(ptr_serializer++);
cout << "dimension "<<_dimension<<endl;
_nb_elems=*(ptr_serializer++);
cout << "nbelems "<<_nb_elems<<endl;
_local_array_indices.resize(_dimension);
for (int i=0; i<_dimension; i++)
{
- _nb_procs_per_dim[i]=*(ptr_serializer++);
+ _nb_procs_per_dim[i]=(int)*(ptr_serializer++);
_cycle_type[i]=(CYCLE_TYPE)*(ptr_serializer++);
_local_array_indices[i].resize(*(ptr_serializer++));
- for (int j=0; j<(int)_local_array_indices[i].size(); j++)
+ for (std::size_t j=0; j<_local_array_indices[i].size(); j++)
_local_array_indices[i][j]=*(ptr_serializer++);
}
set<int> procs;
- int size_comm=*(ptr_serializer++);
+ mcIdType size_comm=*(ptr_serializer++);
for (int i=0; i<size_comm; i++)
- procs.insert(*(ptr_serializer++));
+ procs.insert((int)*(ptr_serializer++));
cout << "unserialize..."<<procs.size()<<endl;
_proc_group=new MPIProcessorGroup(comm_interface,procs);
_owns_processor_group=true;
BlockTopology();
BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid);
BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo);
- BlockTopology(const ProcessorGroup& group, int nb_elem);
+ BlockTopology(const ProcessorGroup& group, mcIdType nb_elem);
virtual ~BlockTopology();
//!Retrieves the number of elements for a given topology
- int getNbElements()const { return _nb_elems; }
- int getNbLocalElements() const;
+ mcIdType getNbElements()const { return _nb_elems; }
+ mcIdType getNbLocalElements() const;
const ProcessorGroup* getProcGroup()const { return _proc_group; }
- std::pair<int,int> globalToLocal (const int) const ;
- int localToGlobal (const std::pair<int,int>) const;
- std::vector<std::pair<int,int> > getLocalArrayMinMax() const ;
+ std::pair<int,mcIdType> globalToLocal (const mcIdType) const ;
+ mcIdType localToGlobal (const std::pair<int,mcIdType>) const;
+ std::vector<std::pair<int,mcIdType> > getLocalArrayMinMax() const ;
int getDimension() const { return _dimension; }
- void serialize(int* & serializer, int& size) const ;
- void unserialize(const int* serializer, const CommInterface& comm_interface);
+ void serialize(mcIdType* & serializer, mcIdType& size) const ;
+ void unserialize(const mcIdType* serializer, const CommInterface& comm_interface);
private:
//dimension : 2 or 3
int _dimension;
//proc array
std::vector<int> _nb_procs_per_dim;
//stores the offsets vector
- std::vector<std::vector<int> > _local_array_indices;
+ std::vector<std::vector<mcIdType> > _local_array_indices;
//stores the cycle type (block or cyclic)
std::vector<CYCLE_TYPE> _cycle_type;
//Processor group
const ProcessorGroup* _proc_group;
//nb of elements
- int _nb_elems;
+ mcIdType _nb_elems;
bool _owns_processor_group;
};
}
ADD_DEFINITIONS(${MPI_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
INCLUDE_DIRECTORIES(
${MPI_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
#define __COMMINTERFACE_HXX__
#include <mpi.h>
+
+#include "ParaIdType.hxx"
+
namespace MEDCoupling
{
//!returns the number of the first MED component on local processor
int firstLocalComponent() const ;
//!returns the number of blocks in the topology
- int nbBlocks()const {return _component_array.size()-1;}
+ int nbBlocks()const {return (int)_component_array.size()-1;}
//!returns the block structure
const std::vector<int>* getBlockIndices() const { return &_component_array; }
const ProcessorGroup* getProcGroup()const { return _proc_group; }
const std::set<int>& target_ids,
const MPI_Comm& world_comm):
_local_field(0),
+ _comm_interface(0),
_owns_field(false),
_owns_groups(true),
- _comm_interface(0),
_union_comm(MPI_COMM_NULL)
{
MEDCoupling::CommInterface comm;
// Create a communicator on these procs
MPI_Group union_group,world_group;
comm.commGroup(world_comm,&world_group);
- comm.groupIncl(world_group,union_ids.size(),union_ranks_world,&union_group);
+ comm.groupIncl(world_group,(int)union_ids.size(),union_ranks_world,&union_group);
comm.commCreate(world_comm,union_group,&_union_comm);
delete[] union_ranks_world;
if (_union_comm==MPI_COMM_NULL)
int* target_ranks_world=new int[target_ids.size()]; // ranks of targets in world_comm
std::copy(target_ids.begin(), target_ids.end(),target_ranks_world);
int* target_ranks_union=new int[target_ids.size()]; // ranks of targets in union_comm
- MPI_Group_translate_ranks(world_group,source_ids.size(),source_ranks_world,union_group,source_ranks_union);
- MPI_Group_translate_ranks(world_group,target_ids.size(),target_ranks_world,union_group,target_ranks_union);
+ MPI_Group_translate_ranks(world_group,(int)source_ids.size(),source_ranks_world,union_group,source_ranks_union);
+ MPI_Group_translate_ranks(world_group,(int)target_ids.size(),target_ranks_world,union_group,target_ranks_union);
std::set<int> source_ids_union;
for (int i=0;i<(int)source_ids.size();i++)
source_ids_union.insert(source_ranks_union[i]);
std::set<int> union_ids; // source and target ids in world_comm
union_ids.insert(src->getProcIDs().begin(),src->getProcIDs().end());
union_ids.insert(tgt->getProcIDs().begin(),tgt->getProcIDs().end());
- if(union_ids.size()!=size)
+ if((int)union_ids.size()!=size)
throw INTERP_KERNEL::Exception("DisjointDEC constructor: source_ids and target_ids do not form a partition of the communicator! Restrain the world communicator passed to MPIProcessorGroup ctor.");
}
void DisjointDEC::renormalizeTargetField(bool isWAbs)
{
if (_source_group->containsMyRank())
- for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
+ for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
{
double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
double source_norm = total_norm;
}
if (_target_group->containsMyRank())
{
- for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
+ for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++)
{
double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs);
double source_norm=total_norm;
*/
void ElementLocator::exchangeMesh(int idistantrank,
MEDCouplingPointSet*& distant_mesh,
- int*& distant_ids)
+ mcIdType*& distant_ids)
{
int rank = _union_group->translateRank(&_distant_group,idistantrank);
if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end())
return;
- MCAuto<DataArrayInt> elems;
+ MCAuto<DataArrayIdType> elems;
#ifdef USE_DIRECTED_BB
INTERP_KERNEL::DirectedBoundingBox dbb;
double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim);
elems=_local_cell_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment());
#endif
- DataArrayInt *distant_ids_send;
+ DataArrayIdType *distant_ids_send;
MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send);
_exchangeMesh(send_mesh, distant_mesh, idistantrank, distant_ids_send, distant_ids);
distant_ids_send->decrRef();
void ElementLocator::_exchangeMesh( MEDCouplingPointSet* local_mesh,
MEDCouplingPointSet*& distant_mesh,
int iproc_distant,
- const DataArrayInt* distant_ids_send,
- int*& distant_ids_recv)
+ const DataArrayIdType* distant_ids_send,
+ mcIdType*& distant_ids_recv)
{
CommInterface comm_interface=_union_group->getCommInterface();
// First stage : exchanging sizes
// ------------------------------
vector<double> tinyInfoLocalD,tinyInfoDistantD(1);//not used for the moment
- vector<int> tinyInfoLocal,tinyInfoDistant;
+ vector<mcIdType> tinyInfoLocal,tinyInfoDistant;
vector<string> tinyInfoLocalS;
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
//the transmitted mesh.
int iprocdistant_in_union = group->translateRank(&_distant_group,
iproc_distant);
- comm_interface.sendRecv(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, iprocdistant_in_union, 1112,
- &tinyInfoDistant[0], tinyInfoDistant.size(), MPI_INT,iprocdistant_in_union,1112,
+ comm_interface.sendRecv(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, iprocdistant_in_union, 1112,
+ &tinyInfoDistant[0], (int)tinyInfoDistant.size(), MPI_ID_TYPE,iprocdistant_in_union,1112,
*comm, &status);
- DataArrayInt *v1Local=0;
+ DataArrayIdType *v1Local=0;
DataArrayDouble *v2Local=0;
- DataArrayInt *v1Distant=DataArrayInt::New();
+ DataArrayIdType *v1Distant=DataArrayIdType::New();
DataArrayDouble *v2Distant=DataArrayDouble::New();
//serialization of local mesh to send data to distant proc.
local_mesh->serialize(v1Local,v2Local);
MEDCouplingPointSet *distant_mesh_tmp=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]);
std::vector<std::string> unusedTinyDistantSts;
distant_mesh_tmp->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
- int nbLocalElems=0;
- int nbDistElem=0;
- int *ptLocal=0;
- int *ptDist=0;
+ mcIdType nbLocalElems=0;
+ mcIdType nbDistElem=0;
+ mcIdType *ptLocal=0;
+ mcIdType *ptDist=0;
if(v1Local)
{
nbLocalElems=v1Local->getNbOfElems();
nbDistElem=v1Distant->getNbOfElems();
ptDist=v1Distant->getPointer();
}
- comm_interface.sendRecv(ptLocal, nbLocalElems, MPI_INT,
+ comm_interface.sendRecv(ptLocal, (int)nbLocalElems, MPI_ID_TYPE,
iprocdistant_in_union, 1111,
- ptDist, nbDistElem, MPI_INT,
+ ptDist, (int)nbDistElem, MPI_ID_TYPE,
iprocdistant_in_union,1111,
*comm, &status);
nbLocalElems=0;
nbDistElem=v2Distant->getNbOfElems();
ptDist2=v2Distant->getPointer();
}
- comm_interface.sendRecv(ptLocal2, nbLocalElems, MPI_DOUBLE,
+ comm_interface.sendRecv(ptLocal2, (int)nbLocalElems, MPI_DOUBLE,
iprocdistant_in_union, 1112,
- ptDist2, nbDistElem, MPI_DOUBLE,
+ ptDist2, (int)nbDistElem, MPI_DOUBLE,
iprocdistant_in_union, 1112,
*comm, &status);
//
//finish unserialization
distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
//
- distant_ids_recv=new int[tinyInfoDistant.back()];
- comm_interface.sendRecv(const_cast<void *>(reinterpret_cast<const void *>(distant_ids_send->getConstPointer())),tinyInfoLocal.back(), MPI_INT,
+ distant_ids_recv=new mcIdType[tinyInfoDistant.back()];
+ comm_interface.sendRecv(const_cast<void *>(reinterpret_cast<const void *>(distant_ids_send->getConstPointer())),(int)tinyInfoLocal.back(), MPI_ID_TYPE,
iprocdistant_in_union, 1113,
- distant_ids_recv,tinyInfoDistant.back(), MPI_INT,
+ distant_ids_recv,(int)tinyInfoDistant.back(), MPI_ID_TYPE,
iprocdistant_in_union,1113,
*comm, &status);
if(v1Local)
/*!
* connected with ElementLocator::recvFromWorkingSideL
*/
- void ElementLocator::sendSumToLazySideW(const std::vector< std::vector<int> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds)
+ void ElementLocator::sendSumToLazySideW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds)
{
int procId=0;
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& eltIds=distantLocEltIds[procId];
+ const vector<mcIdType>& eltIds=distantLocEltIds[procId];
const vector<double>& valued=partialSumRelToDistantIds[procId];
- int lgth=eltIds.size();
+ int lgth=(int)eltIds.size();
comm.send(&lgth,1,MPI_INT,*iter,1114,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_INT,*iter,1115,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1115,*_comm);
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&valued[0])),lgth,MPI_DOUBLE,*iter,1116,*_comm);
}
}
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
std::vector<double>& vec=globalSumRelToDistantIds[procId];
- comm.recv(&vec[0],vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status);
+ comm.recv(&vec[0],(int)vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status);
}
}
/*!
* connected with ElementLocator::recvLocalIdsFromWorkingSideL
*/
- void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds)
+ void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds)
{
int procId=0;
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& eltIds=distantLocEltIds[procId];
- int lgth=eltIds.size();
+ const vector<mcIdType>& eltIds=distantLocEltIds[procId];
+ int lgth=(int)eltIds.size();
comm.send(&lgth,1,MPI_INT,*iter,1121,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_INT,*iter,1122,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1122,*_comm);
}
}
/*!
* connected with ElementLocator::sendGlobalIdsToWorkingSideL
*/
- void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds, std::vector< std::vector<int> >& globalIds)
+ void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, std::vector< std::vector<mcIdType> >& globalIds)
{
int procId=0;
CommInterface comm;
globalIds.resize(_distant_proc_ids.size());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const std::vector<int>& vec=distantLocEltIds[procId];
- std::vector<int>& global=globalIds[procId];
+ const std::vector<mcIdType>& vec=distantLocEltIds[procId];
+ std::vector<mcIdType>& global=globalIds[procId];
global.resize(vec.size());
- comm.recv(&global[0],vec.size(),MPI_INT,*iter,1123,*_comm,&status);
+ comm.recv(&global[0],(int)vec.size(),MPI_ID_TYPE,*iter,1123,*_comm,&status);
}
}
/*!
* connected with ElementLocator::sendCandidatesGlobalIdsToWorkingSideL
*/
- void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<int> >& globalIds)
+ void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<mcIdType> >& globalIds)
{
int procId=0;
CommInterface comm;
globalIds.resize(_distant_proc_ids.size());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- std::vector<int>& global=globalIds[procId];
+ std::vector<mcIdType>& global=globalIds[procId];
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1132,*_comm,&status);
global.resize(lgth);
- comm.recv(&global[0],lgth,MPI_INT,*iter,1133,*_comm,&status);
+ comm.recv(&global[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm,&status);
}
}
/*!
* connected with ElementLocator::recvSumFromWorkingSideL
*/
- void ElementLocator::sendPartialSumToLazyProcsW(const std::vector<int>& distantGlobIds, const std::vector<double>& sum)
+ void ElementLocator::sendPartialSumToLazyProcsW(const std::vector<mcIdType>& distantGlobIds, const std::vector<double>& sum)
{
int procId=0;
CommInterface comm;
- int lgth=distantGlobIds.size();
+ int lgth=(int)distantGlobIds.size();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
comm.send(&lgth,1,MPI_INT,*iter,1124,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_INT,*iter,1125,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1125,*_comm);
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&sum[0])),lgth,MPI_DOUBLE,*iter,1126,*_comm);
}
}
/*!
* connected with ElementLocator::recvCandidatesForAddElementsL
*/
- void ElementLocator::sendCandidatesForAddElementsW(const std::vector<int>& distantGlobIds)
+ void ElementLocator::sendCandidatesForAddElementsW(const std::vector<mcIdType>& distantGlobIds)
{
int procId=0;
CommInterface comm;
- int lgth=distantGlobIds.size();
+ int lgth=(int)distantGlobIds.size();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&lgth)),1,MPI_INT,*iter,1128,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_INT,*iter,1129,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1129,*_comm);
}
}
/*!
* connected with ElementLocator::sendAddElementsToWorkingSideL
*/
- void ElementLocator::recvAddElementsFromLazyProcsW(std::vector<std::vector<int> >& elementsToAdd)
+ void ElementLocator::recvAddElementsFromLazyProcsW(std::vector<std::vector<mcIdType> >& elementsToAdd)
{
int procId=0;
CommInterface comm;
MPI_Status status;
- int lgth=_distant_proc_ids.size();
+ int lgth=(int)_distant_proc_ids.size();
elementsToAdd.resize(lgth);
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
int locLgth;
- std::vector<int>& eltToFeed=elementsToAdd[procId];
+ std::vector<mcIdType>& eltToFeed=elementsToAdd[procId];
comm.recv(&locLgth,1,MPI_INT,*iter,1130,*_comm,&status);
eltToFeed.resize(locLgth);
- comm.recv(&eltToFeed[0],locLgth,MPI_INT,*iter,1131,*_comm,&status);
+ comm.recv(&eltToFeed[0],locLgth,MPI_ID_TYPE,*iter,1131,*_comm,&status);
}
}
{
CommInterface comm;
int toSend;
- DataArrayInt *isCumulative=_local_para_field.returnCumulativeGlobalNumbering();
+ DataArrayIdType *isCumulative=_local_para_field.returnCumulativeGlobalNumbering();
if(isCumulative)
{
toSend=CUMULATIVE_POLICY;
{
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1114,*_comm,&status);
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
ids.resize(lgth);
vector<double> values(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1115,*_comm,&status);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1115,*_comm,&status);
comm.recv(&values[0],lgth,MPI_DOUBLE,*iter,1116,*_comm,&status);
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
_values_added[ids[i]]+=values[i];
}
}
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
vector<double> valsToSend(ids.size());
vector<double>::iterator iter3=valsToSend.begin();
- for(vector<int>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++)
+ for(vector<mcIdType>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++)
*iter3=_values_added[*iter2];
- comm.send(&valsToSend[0],ids.size(),MPI_DOUBLE,*iter,1117,*_comm);
+ comm.send(&valsToSend[0],(int)ids.size(),MPI_DOUBLE,*iter,1117,*_comm);
//ids.clear();
}
//_ids_per_working_proc.clear();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
int lgth;
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
comm.recv(&lgth,1,MPI_INT,*iter,1121,*_comm,&status);
ids.resize(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1122,*_comm,&status);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1122,*_comm,&status);
}
}
{
int procId=0;
CommInterface comm;
- DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
- const int *globalIdsC=globalIds->getConstPointer();
+ DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
+ const mcIdType *globalIdsC=globalIds->getConstPointer();
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& ids=_ids_per_working_proc[procId];
- vector<int> valsToSend(ids.size());
- vector<int>::iterator iter1=valsToSend.begin();
- for(vector<int>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
+ const vector<mcIdType>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType> valsToSend(ids.size());
+ vector<mcIdType>::iterator iter1=valsToSend.begin();
+ for(vector<mcIdType>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
*iter1=globalIdsC[*iter2];
- comm.send(&valsToSend[0],ids.size(),MPI_INT,*iter,1123,*_comm);
+ comm.send(&valsToSend[0],(int)ids.size(),MPI_ID_TYPE,*iter,1123,*_comm);
}
if(globalIds)
globalIds->decrRef();
*/
void ElementLocator::recvSumFromWorkingSideL()
{
- int procId=0;
- int wProcSize=_distant_proc_ids.size();
+ std::size_t procId=0;
+ std::size_t wProcSize=_distant_proc_ids.size();
CommInterface comm;
_ids_per_working_proc.resize(wProcSize);
_values_per_working_proc.resize(wProcSize);
MPI_Status status;
- std::map<int,double> sums;
+ std::map<mcIdType,double> sums;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1124,*_comm,&status);
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
vector<double>& vals=_values_per_working_proc[procId];
ids.resize(lgth);
vals.resize(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1125,*_comm,&status);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1125,*_comm,&status);
comm.recv(&vals[0],lgth,MPI_DOUBLE,*iter,1126,*_comm,&status);
- vector<int>::const_iterator iter1=ids.begin();
+ vector<mcIdType>::const_iterator iter1=ids.begin();
vector<double>::const_iterator iter2=vals.begin();
for(;iter1!=ids.end();iter1++,iter2++)
sums[*iter1]+=*iter2;
//assign sum to prepare sending to working side
for(procId=0;procId<wProcSize;procId++)
{
- vector<int>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType>& ids=_ids_per_working_proc[procId];
vector<double>& vals=_values_per_working_proc[procId];
- vector<int>::const_iterator iter1=ids.begin();
+ vector<mcIdType>::const_iterator iter1=ids.begin();
vector<double>::iterator iter2=vals.begin();
for(;iter1!=ids.end();iter1++,iter2++)
*iter2=sums[*iter1];
*/
void ElementLocator::recvCandidatesForAddElementsL()
{
- int procId=0;
- int wProcSize=_distant_proc_ids.size();
+ std::size_t procId=0;
+ std::size_t wProcSize=_distant_proc_ids.size();
CommInterface comm;
_ids_per_working_proc3.resize(wProcSize);
MPI_Status status;
std::map<int,double> sums;
- DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
- const int *globalIdsC=globalIds->getConstPointer();
- int nbElts=globalIds->getNumberOfTuples();
- std::set<int> globalIdsS(globalIdsC,globalIdsC+nbElts);
+ DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
+ const mcIdType *globalIdsC=globalIds->getConstPointer();
+ mcIdType nbElts=globalIds->getNumberOfTuples();
+ std::set<mcIdType> globalIdsS(globalIdsC,globalIdsC+nbElts);
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const std::vector<int>& ids0=_ids_per_working_proc[procId];
- int lgth0=ids0.size();
- std::set<int> elts0;
- for(int i=0;i<lgth0;i++)
+ const std::vector<mcIdType>& ids0=_ids_per_working_proc[procId];
+ std::size_t lgth0=ids0.size();
+ std::set<mcIdType> elts0;
+ for(std::size_t i=0;i<lgth0;i++)
elts0.insert(globalIdsC[ids0[i]]);
int lgth;
comm.recv(&lgth,1,MPI_INT,*iter,1128,*_comm,&status);
- vector<int> ids(lgth);
- comm.recv(&ids[0],lgth,MPI_INT,*iter,1129,*_comm,&status);
- set<int> ids1(ids.begin(),ids.end());
+ vector<mcIdType> ids(lgth);
+ comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1129,*_comm,&status);
+ set<mcIdType> ids1(ids.begin(),ids.end());
ids.clear();
set<int> tmp5,tmp6;
set_intersection(globalIdsS.begin(),globalIdsS.end(),ids1.begin(),ids1.end(),inserter(tmp5,tmp5.begin()));
set_difference(tmp5.begin(),tmp5.end(),elts0.begin(),elts0.end(),inserter(tmp6,tmp6.begin()));
- std::vector<int>& ids2=_ids_per_working_proc3[procId];
+ std::vector<mcIdType>& ids2=_ids_per_working_proc3[procId];
ids2.resize(tmp6.size());
std::copy(tmp6.begin(),tmp6.end(),ids2.begin());
//global->local
- for(std::vector<int>::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++)
- *iter2=std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC;
+ for(std::vector<mcIdType>::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++)
+ *iter2=ToIdType(std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC);
}
if(globalIds)
globalIds->decrRef();
CommInterface comm;
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const std::vector<int>& vals=_ids_per_working_proc3[procId];
- int size=vals.size();
+ const std::vector<mcIdType>& vals=_ids_per_working_proc3[procId];
+ int size=(int)vals.size();
comm.send(const_cast<void *>(reinterpret_cast<const void *>(&size)),1,MPI_INT,*iter,1130,*_comm);
- comm.send(const_cast<void *>(reinterpret_cast<const void *>(&vals[0])),size,MPI_INT,*iter,1131,*_comm);
+ comm.send(const_cast<void *>(reinterpret_cast<const void *>(&vals[0])),size,MPI_ID_TYPE,*iter,1131,*_comm);
}
}
{
int procId=0;
CommInterface comm;
- DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
- const int *globalIdsC=globalIds->getConstPointer();
- MCAuto<DataArrayInt> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes();
- for(int *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++)
+ DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering();
+ const mcIdType *globalIdsC=globalIds->getConstPointer();
+ MCAuto<DataArrayIdType> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes();
+ for(mcIdType *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++)
(*iter1)=globalIdsC[*iter1];
- std::set<int> candidatesS(candidates->begin(),candidates->end());
+ std::set<mcIdType> candidatesS(candidates->begin(),candidates->end());
for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
{
- const vector<int>& ids=_ids_per_working_proc[procId];
- vector<int> valsToSend(ids.size());
- vector<int>::iterator iter1=valsToSend.begin();
- for(vector<int>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
+ const vector<mcIdType>& ids=_ids_per_working_proc[procId];
+ vector<mcIdType> valsToSend(ids.size());
+ vector<mcIdType>::iterator iter1=valsToSend.begin();
+ for(vector<mcIdType>::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++)
*iter1=globalIdsC[*iter2];
- std::set<int> tmp2(valsToSend.begin(),valsToSend.end());
- std::vector<int> tmp3;
- set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector<int> >(tmp3));
- int lgth=tmp3.size();
+ std::set<mcIdType> tmp2(valsToSend.begin(),valsToSend.end());
+ std::vector<mcIdType> tmp3;
+ set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp3));
+ int lgth=(int)tmp3.size();
comm.send(&lgth,1,MPI_INT,*iter,1132,*_comm);
- comm.send(&tmp3[0],lgth,MPI_INT,*iter,1133,*_comm);
+ comm.send(&tmp3[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm);
}
if(globalIds)
globalIds->decrRef();
virtual ~ElementLocator();
void exchangeMesh(int idistantrank,
MEDCouplingPointSet*& target_mesh,
- int*& distant_ids);
+ mcIdType*& distant_ids);
void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth);
const std::vector<int>& getDistantProcIds() const { return _distant_proc_ids; }
const MPI_Comm *getCommunicator() const;
bool isM1DCorr() const { return _is_m1d_corr; }
//Working side methods
void recvPolicyFromLazySideW(std::vector<int>& policy);
- void sendSumToLazySideW(const std::vector< std::vector<int> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds);
+ void sendSumToLazySideW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds);
void recvSumFromLazySideW(std::vector< std::vector<double> >& globalSumRelToDistantIds);
- void sendCandidatesForAddElementsW(const std::vector<int>& distantGlobIds);
- void recvAddElementsFromLazyProcsW(std::vector<std::vector<int> >& elementsToAdd);
+ void sendCandidatesForAddElementsW(const std::vector<mcIdType>& distantGlobIds);
+ void recvAddElementsFromLazyProcsW(std::vector<std::vector<mcIdType> >& elementsToAdd);
//
- void sendLocalIdsToLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds);
- void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds, std::vector< std::vector<int> >& globalIds);
- void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<int> >& globalIds);
- void sendPartialSumToLazyProcsW(const std::vector<int>& distantGlobIds, const std::vector<double>& sum);
+ void sendLocalIdsToLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds);
+ void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<mcIdType> >& distantLocEltIds, std::vector< std::vector<mcIdType> >& globalIds);
+ void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<mcIdType> >& globalIds);
+ void sendPartialSumToLazyProcsW(const std::vector<mcIdType>& distantGlobIds, const std::vector<double>& sum);
//Lazy side methods
int sendPolicyToWorkingSideL();
void recvFromWorkingSideL();
void _computeBoundingBoxes();
bool _intersectsBoundingBox(int irank);
void _exchangeMesh(MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh,
- int iproc_distant, const DataArrayInt* distant_ids_send,
- int*& distant_ids_recv);
+ int iproc_distant, const DataArrayIdType* distant_ids_send,
+ mcIdType*& distant_ids_recv);
private:
const ParaFIELD& _local_para_field ;
MEDCouplingPointSet* _local_cell_mesh;
const MPI_Comm *_comm;
//Attributes only used by lazy side
std::vector<double> _values_added;
- std::vector< std::vector<int> > _ids_per_working_proc;
- std::vector< std::vector<int> > _ids_per_working_proc3;
+ std::vector< std::vector<mcIdType> > _ids_per_working_proc;
+ std::vector< std::vector<mcIdType> > _ids_per_working_proc3;
std::vector< std::vector<double> > _values_per_working_proc;
public:
static const int CUMULATIVE_POLICY=3;
vector<int>* target_arrays=new vector<int>[target_size];
- int nb_local = _toposource-> getNbLocalElements();
+ mcIdType nb_local = _toposource-> getNbLocalElements();
- int union_size=group->size();
+ std::size_t union_size=group->size();
_sendcounts=new int[union_size];
_senddispls=new int[union_size];
_recvcounts=new int[union_size];
_recvdispls=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_sendcounts[i]=0;
_recvcounts[i]=0;
int* counter=new int [target_size];
counter[0]=0;
for (int i=1; i<target_size; i++)
- counter[i]=counter[i-1]+target_arrays[i-1].size();
+ counter[i]=counter[i-1]+(int)target_arrays[i-1].size();
const double* value = _local_field->getField()->getArray()->getPointer();
return;
MPIProcessorGroup* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface());
- vector < vector <int> > source_arrays(_sourcegroup->size());
- int nb_local = _topotarget-> getNbLocalElements();
- for (int ielem=0; ielem< nb_local ; ielem++)
+ vector < vector <mcIdType> > source_arrays(_sourcegroup->size());
+ mcIdType nb_local = _topotarget-> getNbLocalElements();
+ for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
- //pair<int,int> source_local =_distant_elems[ielem];
- pair <int,int> source_local=_explicit_mapping.getDistantNumbering(ielem);
- source_arrays[source_local.first].push_back(source_local.second);
+ //pair<int,mcIdType> source_local =_distant_elems[ielem];
+ pair <int,mcIdType> source_local=_explicit_mapping.getDistantNumbering(ielem);
+ source_arrays[source_local.first].push_back(source_local.second);
}
- int union_size=group->size();
+ std::size_t union_size=group->size();
_recvcounts=new int[union_size];
_recvdispls=new int[union_size];
_sendcounts=new int[union_size];
_senddispls=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_sendcounts[i]=0;
_recvcounts[i]=0;
{
//converts the rank in target to the rank in union communicator
int unionrank=group->translateRank(_sourcegroup,iproc);
- _recvcounts[unionrank]=source_arrays[iproc].size()*_topotarget->getNbComponents();
+ _recvcounts[unionrank]=(int)(source_arrays[iproc].size()*_topotarget->getNbComponents());
}
- for (int i=1; i<union_size; i++)
+ for (std::size_t i=1; i<union_size; i++)
_recvdispls[i]=_recvdispls[i-1]+_recvcounts[i-1];
_recvbuffer=new double[nb_local*_topotarget->getNbComponents()];
{
MPI_Status status;
- int* serializer=0;
- int size;
+ mcIdType* serializer=0;
+ mcIdType size;
MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
int itarget=iproc;
if (!toposend->getProcGroup()->contains(itarget))
{
- _comm_interface->send(&size,1,MPI_INT, itarget,tag+itarget,*(group->getComm()));
- _comm_interface->send(serializer, size, MPI_INT, itarget, tag+itarget,*(group->getComm()));
+ _comm_interface->send(&size,1,MPI_ID_TYPE, itarget,tag+itarget,*(group->getComm()));
+ _comm_interface->send(serializer, (int)size, MPI_ID_TYPE, itarget, tag+itarget,*(group->getComm()));
}
}
}
int isource = iproc;
if (!toporecv->getProcGroup()->contains(isource))
{
- int nbelem;
- _comm_interface->recv(&nbelem, 1, MPI_INT, isource, tag+myworldrank, *(group->getComm()), &status);
- int* buffer = new int[nbelem];
- _comm_interface->recv(buffer, nbelem, MPI_INT, isource,tag+myworldrank, *(group->getComm()), &status);
+ mcIdType nbelem;
+ _comm_interface->recv(&nbelem, 1, MPI_ID_TYPE, isource, tag+myworldrank, *(group->getComm()), &status);
+ mcIdType* buffer = new mcIdType[nbelem];
+ _comm_interface->recv(buffer, (int)nbelem, MPI_ID_TYPE, isource,tag+myworldrank, *(group->getComm()), &status);
ExplicitTopology* topotemp=new ExplicitTopology();
topotemp->unserialize(buffer, *_comm_interface);
delete[] buffer;
- for (int ielem=0; ielem<toporecv->getNbLocalElements(); ielem++)
+ for (mcIdType ielem=0; ielem<toporecv->getNbLocalElements(); ielem++)
{
- int global = toporecv->localToGlobal(ielem);
- int sendlocal=topotemp->globalToLocal(global);
+ mcIdType global = toporecv->localToGlobal(ielem);
+ mcIdType sendlocal=topotemp->globalToLocal(global);
if (sendlocal!=-1)
{
size2[iproc]++;
}
_comm_interface->allToAll(nb_transfer_union, 1, MPI_INT, dummy_recv, 1, MPI_INT, MPI_COMM_WORLD);
- int* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank());
+ mcIdType* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank());
int* sendcounts= new int [world_size];
int* senddispls = new int [world_size];
recvcounts[i]=0;
recvdispls[i]=0;
}
- _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_INT, dummyrecv, recvcounts, senddispls, MPI_INT, MPI_COMM_WORLD);
+ _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_ID_TYPE, dummyrecv, recvcounts, senddispls, MPI_ID_TYPE, MPI_COMM_WORLD);
}
//receiving in the source subdomains the mapping sent by targets
int* targetranks = new int[ nbtarget];
for (int i=0; i<nbtarget; i++)
targetranks[i]=group->translateRank(_targetgroup,i);
- int* mappingbuffer= new int [total_size*2];
+ mcIdType* mappingbuffer= new mcIdType [total_size*2];
int* sendcounts= new int [world_size];
int* senddispls = new int [world_size];
int* recvcounts=new int[world_size];
sendcounts[i]=0;
senddispls[i]=0;
}
- _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_INT, mappingbuffer, recvcounts, recvdispls, MPI_INT, MPI_COMM_WORLD);
+ _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_ID_TYPE, mappingbuffer, recvcounts, recvdispls, MPI_ID_TYPE, MPI_COMM_WORLD);
_explicit_mapping.unserialize(world_size,nb_transfer_union,nbtarget, targetranks, mappingbuffer);
}
}
_comm_interface->allToAllV(_sendbuffer, _sendcounts, _senddispls, MPI_DOUBLE,
_recvbuffer, _recvcounts, _recvdispls, MPI_DOUBLE,MPI_COMM_WORLD);
cout<<"end AllToAll"<<endl;
- int nb_local = _topotarget->getNbLocalElements();
+ mcIdType nb_local = _topotarget->getNbLocalElements();
double* value=new double[nb_local*_topotarget->getNbComponents()];
vector<int> counters(_sourcegroup->size());
if (_comm_buffer!=0) delete[] _comm_buffer;
}
- void ExplicitMapping::pushBackElem(std::pair<int,int> idistant)
+ void ExplicitMapping::pushBackElem(std::pair<int,mcIdType> idistant)
{
_mapping.push_back(idistant);
}
- void ExplicitMapping::setDistantElem(int ilocal, std::pair<int,int> idistant)
+ void ExplicitMapping::setDistantElem(mcIdType ilocal, std::pair<int,mcIdType> idistant)
{
_mapping[ilocal]=idistant;
}
{
if (_distant_domains.empty())
{
- for (std::vector <std::pair<int,int> >::const_iterator iter= _mapping.begin();
+ for (std::vector <std::pair<int,mcIdType> >::const_iterator iter= _mapping.begin();
iter!=_mapping.end();
iter++)
_distant_domains.insert(iter->first);
}
- return _distant_domains.size();
+ return (int)_distant_domains.size();
}
- std::pair <int,int> ExplicitMapping::getDistantNumbering(int ielem)const
+ std::pair <int,mcIdType> ExplicitMapping::getDistantNumbering(mcIdType ielem)const
{
return _mapping[ielem];
}
return _numbers[i];
}
- int* ExplicitMapping::serialize(int idproc)
+ mcIdType* ExplicitMapping::serialize(int idproc)
{
- _comm_buffer=new int[_mapping.size()*2];
- std::vector<int> offsets(_distant_domains.size());
+ _comm_buffer=new mcIdType[_mapping.size()*2];
+ std::vector<mcIdType> offsets(_distant_domains.size());
offsets[0]=0;
for (int i=1; i<(int)_distant_domains.size();i++)
offsets[i]=offsets[i-1]+_numbers[i-1];
for (int i=0; i<(int)_mapping.size(); i++)
{
- int offset= offsets[_mapping[i].first];
+ mcIdType offset= offsets[_mapping[i].first];
_comm_buffer[offset*2]=idproc;
_comm_buffer[offset*2+1]=_mapping[i].second;
offsets[_mapping[i].first]++;
return _comm_buffer;
}
- void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer)
+ void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer)
{
int total_size=0;
for (int i=0; i< nbprocs; i++)
{
_mapping[indmap].first=i;
_mapping[indmap].second=commbuffer[indmap*2+1];
- _buffer_index[indmap]=commbuffer[indmap*2+1];
+ _buffer_index[indmap]=(int)commbuffer[indmap*2+1];
indmap++;
}
_numbers=new int [nbtarget];
#ifndef __EXPLICITMAPPING_HXX__
#define __EXPLICITMAPPING_HXX__
+#include "MCIdType.hxx"
+
#include <vector>
#include <map>
#include <set>
ExplicitMapping();
~ExplicitMapping();
- void pushBackElem(std::pair<int,int> idistant);
- void setDistantElem(int ilocal, std::pair<int,int> idistant);
+ void pushBackElem(std::pair<int,mcIdType> idistant);
+ void setDistantElem(mcIdType ilocal, std::pair<int,mcIdType> idistant);
int nbDistantDomains();
- std::pair <int,int> getDistantNumbering(int ielem) const;
+ std::pair <int,mcIdType> getDistantNumbering(mcIdType ielem) const;
int getDistantDomain(int i);
int getNbDistantElems(int i);
- int* serialize(int idproc);
- void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer);
+ mcIdType* serialize(int idproc);
+ void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer);
int* getBufferIndex() const { return _buffer_index; }
int* getCounts() const { return _send_counts; }
private:
- std::vector <std::pair<int,int> > _mapping;
+ std::vector <std::pair<int,mcIdType> > _mapping;
std::set<int> _distant_domains;
int* _numbers;
int* _domains;
- int* _comm_buffer;
+ mcIdType* _comm_buffer;
int* _buffer_index;
int* _send_counts;
_nb_components(1)
{
_nb_elems=paramesh.getCellMesh()->getNumberOfCells();
- const int* global=paramesh.getGlobalNumberingCell();
- _loc2glob=new int[_nb_elems];
+ const mcIdType* global=paramesh.getGlobalNumberingCell();
+ _loc2glob=new mcIdType[_nb_elems];
- for (int i=0; i<_nb_elems; i++)
+ for (mcIdType i=0; i<_nb_elems; i++)
{
_loc2glob[i]=global[i];
_glob2loc[global[i]]=i;
_proc_group = topo._proc_group;
_nb_elems = topo._nb_elems;
_nb_components = nb_components;
- _loc2glob=new int[_nb_elems];
- for (int i=0; i<_nb_elems; i++)
+ _loc2glob=new mcIdType[_nb_elems];
+ for (mcIdType i=0; i<_nb_elems; i++)
{
_loc2glob[i]=topo._loc2glob[i];
}
/*! Serializes the data contained in the Explicit Topology
* for communication purposes*/
-void ExplicitTopology::serialize(int* & serializer, int& size) const
+void ExplicitTopology::serialize(mcIdType* & serializer, mcIdType& size) const
{
- vector <int> buffer;
+ vector <mcIdType> buffer;
buffer.push_back(_nb_elems);
- for (int i=0; i<_nb_elems; i++)
+ for (mcIdType i=0; i<_nb_elems; i++)
{
buffer.push_back(_loc2glob[i]);
}
- serializer=new int[buffer.size()];
- size= buffer.size();
+ serializer=new mcIdType[buffer.size()];
+ size=ToIdType(buffer.size());
copy(buffer.begin(), buffer.end(), serializer);
}
* after communication. Uses the same structure as the one used for serialize()
*
* */
-void ExplicitTopology::unserialize(const int* serializer,const CommInterface& comm_interface)
+void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface)
{
- const int* ptr_serializer=serializer;
+ const mcIdType* ptr_serializer=serializer;
cout << "unserialize..."<<endl;
_nb_elems=*ptr_serializer++;
cout << "nbelems "<<_nb_elems<<endl;
- _loc2glob=new int[_nb_elems];
- for (int i=0; i<_nb_elems; i++)
+ _loc2glob=new mcIdType[_nb_elems];
+ for (mcIdType i=0; i<_nb_elems; i++)
{
_loc2glob[i]=*ptr_serializer;
_glob2loc[*ptr_serializer]=i;
ExplicitTopology(const ParaMESH &mesh);
virtual ~ExplicitTopology();
- inline int getNbElements()const;
- inline int getNbLocalElements() const;
+ inline mcIdType getNbElements()const;
+ inline mcIdType getNbLocalElements() const;
const ProcessorGroup* getProcGroup()const { return _proc_group; }
- int localToGlobal (const std::pair<int,int> local) const { return localToGlobal(local.second); }
- inline int localToGlobal(int) const;
- inline int globalToLocal(int) const;
- void serialize(int* & serializer, int& size) const ;
- void unserialize(const int* serializer, const CommInterface& comm_interface);
+ mcIdType localToGlobal (const std::pair<int,mcIdType> local) const { return localToGlobal(local.second); }
+ inline mcIdType localToGlobal(mcIdType) const;
+ inline mcIdType globalToLocal(mcIdType) const;
+ void serialize(mcIdType* & serializer, mcIdType& size) const ;
+ void unserialize(const mcIdType* serializer, const CommInterface& comm_interface);
int getNbComponents() const { return _nb_components; }
private:
//Processor group
const ProcessorGroup* _proc_group;
//nb of elements
- int _nb_elems;
+ mcIdType _nb_elems;
//nb of components
int _nb_components;
//mapping local to global
- int* _loc2glob;
+ mcIdType* _loc2glob;
//mapping global to local
- INTERP_KERNEL::HashMap<int,int> _glob2loc;
+ INTERP_KERNEL::HashMap<mcIdType,mcIdType> _glob2loc;
};
//!converts a pair <subdomainid,local> to a global number
- inline int ExplicitTopology::globalToLocal(const int global) const
+ inline mcIdType ExplicitTopology::globalToLocal(const mcIdType global) const
{
- return (_glob2loc.find(global))->second;;
+ return (_glob2loc.find(global))->second;
}
//!converts local number to a global number
- int ExplicitTopology::localToGlobal(int local) const
+ mcIdType ExplicitTopology::localToGlobal(mcIdType local) const
{
return _loc2glob[local];
}
//!Retrieves the number of elements for a given topology
- inline int ExplicitTopology::getNbElements() const
+ inline mcIdType ExplicitTopology::getNbElements() const
{
return _nb_elems;
}
//Retrieves the local number of elements
- inline int ExplicitTopology::getNbLocalElements()const
+ inline mcIdType ExplicitTopology::getNbLocalElements()const
{
- return _glob2loc.size();
+ return ToIdType(_glob2loc.size());
}
}
//transferring option from InterpKernelDEC to ElementLocator
locator.copyOptions(*this);
MEDCouplingPointSet* distant_mesh=0;
- int* distant_ids=0;
+ mcIdType* distant_ids=0;
std::string distantMeth;
for (int i=0; i<_target_group->size(); i++)
{
//transferring option from InterpKernelDEC to ElementLocator
locator.copyOptions(*this);
MEDCouplingPointSet* distant_mesh=0;
- int* distant_ids=0;
+ mcIdType* distant_ids=0;
for (int i=0; i<_source_group->size(); i++)
{
// int idistant_proc = (i+_target_group->myRank())%_source_group->size();
_source_group(source_group),
_target_group(target_group)
{
- int nbelems = source_field->getField()->getNumberOfTuples();
+ mcIdType nbelems = source_field->getField()->getNumberOfTuples();
_row_offsets.resize(nbelems+1);
_coeffs.resize(nbelems);
_target_volume.resize(nbelems);
*/
void InterpolationMatrix::addContribution ( MEDCouplingPointSet& distant_support,
int iproc_distant,
- const int* distant_elems,
+ const mcIdType* distant_elems,
const std::string& srcMeth,
const std::string& targetMeth)
{
std::string interpMethod(targetMeth);
interpMethod+=srcMeth;
//creating the interpolator structure
- vector<map<int,double> > surfaces;
+ vector<map<mcIdType,double> > surfaces;
//computation of the intersection volumes between source and target elements
MEDCouplingUMesh *distant_supportC=dynamic_cast<MEDCouplingUMesh *>(&distant_support);
MEDCouplingUMesh *source_supportC=dynamic_cast<MEDCouplingUMesh *>(_source_support);
target_triangle_surf->decrRef();
}
- void InterpolationMatrix::fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map<int,double> >& values, MEDCouplingFieldDouble *surf)
+ void InterpolationMatrix::fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map<mcIdType,double> >& values, MEDCouplingFieldDouble *surf)
{
//loop over the elements to build the interpolation
//matrix structures
- int source_size=values.size();
- for (int ielem=0; ielem < source_size; ielem++)
+ std::size_t source_size=values.size();
+ for (std::size_t ielem=0; ielem < source_size; ielem++)
{
- _row_offsets[ielem+1] += values[ielem].size();
- for(map<int,double>::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++)
+ _row_offsets[ielem+1] += ToIdType(values[ielem].size());
+ for(map<mcIdType,double>::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++)
{
- int localId;
+ mcIdType localId;
if(distant_elems)
localId=distant_elems[iter->first];
else
localId=iter->first;
//locating the (iproc, itriangle) pair in the list of columns
- map<pair<int,int>,int >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId));
- int col_id;
+ map<pair<int,mcIdType>,mcIdType >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId));
+ mcIdType col_id;
if (iter2 == _col_offsets.end())
{
//(iproc, itriangle) is not registered in the list
//of distant elements
- col_id =_col_offsets.size();
+ col_id =ToIdType(_col_offsets.size());
_col_offsets.insert(make_pair(make_pair(iproc_distant,localId),col_id));
_mapping.addElementFromSource(iproc_distant,localId);
}
}
}
- void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map<int,double> > >& data1, std::vector<int>& data2) const
+ void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map<mcIdType,double> > >& data1, std::vector<int>& data2) const
{
data1.clear();
data2.clear();
- const std::vector<std::pair<int,int> >& sendingIds=_mapping.getSendingIds();
+ const std::vector<std::pair<int,mcIdType> >& sendingIds=_mapping.getSendingIds();
std::set<int> procsS;
- for(std::vector<std::pair<int,int> >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++)
+ for(std::vector<std::pair<int,mcIdType> >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++)
procsS.insert((*iter1).first);
data1.resize(procsS.size());
data2.resize(procsS.size());
int id=0;
for(std::set<int>::const_iterator iter2=procsS.begin();iter2!=procsS.end();iter2++,id++)
fastProcAcc[*iter2]=id;
- int nbOfSrcElt=_coeffs.size();
- for(std::vector< std::vector< std::map<int,double> > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++)
+ mcIdType nbOfSrcElt=ToIdType(_coeffs.size());
+ for(std::vector< std::vector< std::map<mcIdType,double> > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++)
(*iter3).resize(nbOfSrcElt);
id=0;
for(std::vector< std::vector< std::pair<int,double> > >::const_iterator iter4=_coeffs.begin();iter4!=_coeffs.end();iter4++,id++)
{
for(std::vector< std::pair<int,double> >::const_iterator iter5=(*iter4).begin();iter5!=(*iter4).end();iter5++)
{
- const std::pair<int,int>& elt=sendingIds[(*iter5).first];
+ const std::pair<int,mcIdType>& elt=sendingIds[(*iter5).first];
data1[fastProcAcc[elt.first]][id][elt.second]=(*iter5).second;
}
}
void InterpolationMatrix::initialize()
{
- int lgth=_coeffs.size();
+ mcIdType lgth=ToIdType(_coeffs.size());
_row_offsets.clear(); _row_offsets.resize(lgth+1);
_coeffs.clear(); _coeffs.resize(lgth);
_target_volume.clear(); _target_volume.resize(lgth);
void InterpolationMatrix::computeGlobalRowSum(ElementLocator& elementLocator, std::vector<std::vector<double> >& denoStrorage, std::vector<std::vector<double> >& denoStrorageInv)
{
//stores id in distant procs sorted by lazy procs connected with
- vector< vector<int> > rowsPartialSumI;
+ vector< vector<mcIdType> > rowsPartialSumI;
//stores for each lazy procs connected with, if global info is available and if it's the case the policy
vector<int> policyPartial;
//stores the corresponding values.
//updateWithNewAdditionnalElements(addingElements);
//stores for each lazy procs connected with, the ids in global mode if it exists (regarding policyPartial). This array has exactly the size of rowsPartialSumI,
//if policyPartial has CUMALATIVE_POLICY in each.
- vector< vector<int> > globalIdsPartial;
+ vector< vector<mcIdType> > globalIdsPartial;
computeLocalRowSum(elementLocator.getDistantProcIds(),rowsPartialSumI,rowsPartialSumD);
elementLocator.sendLocalIdsToLazyProcsW(rowsPartialSumI);
elementLocator.recvCandidatesGlobalIdsFromLazyProcsW(globalIdsPartial);
- std::vector< std::vector<int> > addingElements;
+ std::vector< std::vector<mcIdType> > addingElements;
findAdditionnalElements(elementLocator,addingElements,rowsPartialSumI,globalIdsPartial);
addGhostElements(elementLocator.getDistantProcIds(),addingElements);
rowsPartialSumI.clear();
* It contains the element ids (2nd dimension) of the corresponding lazy proc.
* @param resPerProcD out parameter with the same format than 'resPerProcI'. It contains corresponding sum values.
*/
- void InterpolationMatrix::computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<int> >& resPerProcI,
+ void InterpolationMatrix::computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<mcIdType> >& resPerProcI,
std::vector<std::vector<double> >& resPerProcD) const
{
resPerProcI.resize(distantProcs.size());
for(vector<pair<int,double> >::const_iterator iter3=(*iter).begin();iter3!=(*iter).end();iter3++)
res[(*iter3).first]+=(*iter3).second;
set<int> procsSet;
- int id=-1;
- const vector<std::pair<int,int> >& mapping=_mapping.getSendingIds();
- for(vector<std::pair<int,int> >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++)
+ std::size_t id=-1;
+ const vector<std::pair<int,mcIdType> >& mapping=_mapping.getSendingIds();
+ for(vector<std::pair<int,mcIdType> >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++)
{
std::pair<set<int>::iterator,bool> isIns=procsSet.insert((*iter2).first);
if(isIns.second)
* This method is only usable when CUMULATIVE_POLICY detected. This method finds elements ids (typically nodes) lazy side that
* are not present in columns of 'this' and that should regarding cumulative merge of elements regarding their global ids.
*/
- void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<int> >& elementsToAdd,
- const std::vector<std::vector<int> >& resPerProcI, const std::vector<std::vector<int> >& globalIdsPartial)
+ void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<mcIdType> >& elementsToAdd,
+ const std::vector<std::vector<mcIdType> >& resPerProcI, const std::vector<std::vector<mcIdType> >& globalIdsPartial)
{
- std::set<int> globalIds;
- int nbLazyProcs=globalIdsPartial.size();
- for(int i=0;i<nbLazyProcs;i++)
+ std::set<mcIdType> globalIds;
+ std::size_t nbLazyProcs=globalIdsPartial.size();
+ for(std::size_t i=0;i<nbLazyProcs;i++)
globalIds.insert(globalIdsPartial[i].begin(),globalIdsPartial[i].end());
- std::vector<int> tmp(globalIds.size());
+ std::vector<mcIdType> tmp(globalIds.size());
std::copy(globalIds.begin(),globalIds.end(),tmp.begin());
globalIds.clear();
elementLocator.sendCandidatesForAddElementsW(tmp);
elementLocator.recvAddElementsFromLazyProcsW(elementsToAdd);
}
- void InterpolationMatrix::addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& elementsToAdd)
+ void InterpolationMatrix::addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& elementsToAdd)
{
- std::vector< std::vector< std::map<int,double> > > data1;
+ std::vector< std::vector< std::map<mcIdType,double> > > data1;
std::vector<int> data2;
serializeMe(data1,data2);
initialize();
- int nbOfDistProcs=distantProcs.size();
- for(int i=0;i<nbOfDistProcs;i++)
+ std::size_t nbOfDistProcs=distantProcs.size();
+ for(std::size_t i=0;i<nbOfDistProcs;i++)
{
int procId=distantProcs[i];
- const std::vector<int>& eltsForThisProc=elementsToAdd[i];
+ const std::vector<mcIdType>& eltsForThisProc=elementsToAdd[i];
if(!eltsForThisProc.empty())
{
std::vector<int>::iterator iter1=std::find(data2.begin(),data2.end(),procId);
- std::map<int,double> *toFeed=0;
+ std::map<mcIdType,double> *toFeed=0;
if(iter1!=data2.end())
{//to test
- int rank=iter1-data2.begin();
+ std::size_t rank=iter1-data2.begin();
toFeed=&(data1[rank].back());
}
else
{
iter1=std::lower_bound(data2.begin(),data2.end(),procId);
- int rank=iter1-data2.begin();
+ std::size_t rank=iter1-data2.begin();
data2.insert(iter1,procId);
- std::vector< std::map<int,double> > tmp(data1.front().size());
+ std::vector< std::map<mcIdType,double> > tmp(data1.front().size());
data1.insert(data1.begin()+rank,tmp);
toFeed=&(data1[rank].back());
}
- for(std::vector<int>::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++)
+ for(std::vector<mcIdType>::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++)
(*toFeed)[*iter2]=0.;
}
}
//
nbOfDistProcs=data2.size();
- for(int j=0;j<nbOfDistProcs;j++)
+ for(std::size_t j=0;j<nbOfDistProcs;j++)
fillDSFromVM(data2[j],0,data1[j],0);
}
* @param globalIdsLazySideInteraction : out parameter, constituted from all global ids of lazy procs connected with.
* @para sumCorresponding : out parameter, relative to 'globalIdsLazySideInteraction'
*/
- void InterpolationMatrix::mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<int> >& globalIdsPartial,
- std::vector<int>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding)
+ void InterpolationMatrix::mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<mcIdType> >& globalIdsPartial,
+ std::vector<mcIdType>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding)
{
- std::map<int,double> sumToReturn;
- int nbLazyProcs=rowsPartialSumD.size();
- for(int i=0;i<nbLazyProcs;i++)
+ std::map<mcIdType,double> sumToReturn;
+ std::size_t nbLazyProcs=rowsPartialSumD.size();
+ for(std::size_t i=0;i<nbLazyProcs;i++)
{
const std::vector<double>& rowSumOfP=rowsPartialSumD[i];
- const std::vector<int>& globalIdsOfP=globalIdsPartial[i];
+ const std::vector<mcIdType>& globalIdsOfP=globalIdsPartial[i];
std::vector<double>::const_iterator iter1=rowSumOfP.begin();
- std::vector<int>::const_iterator iter2=globalIdsOfP.begin();
+ std::vector<mcIdType>::const_iterator iter2=globalIdsOfP.begin();
for(;iter1!=rowSumOfP.end();iter1++,iter2++)
sumToReturn[*iter2]+=*iter1;
}
//
- int lgth=sumToReturn.size();
+ std::size_t lgth=sumToReturn.size();
globalIdsLazySideInteraction.resize(lgth);
sumCorresponding.resize(lgth);
- std::vector<int>::iterator iter3=globalIdsLazySideInteraction.begin();
+ std::vector<mcIdType>::iterator iter3=globalIdsLazySideInteraction.begin();
std::vector<double>::iterator iter4=sumCorresponding.begin();
- for(std::map<int,double>::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++)
+ for(std::map<mcIdType,double>::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++)
{
*iter3=(*iter5).first;
*iter4=(*iter5).second;
* @param globalIdsLazySideInteraction : in parameter that represents ALL the global ids of every lazy procs in interaction
* @param sumCorresponding : in parameter with same size as 'globalIdsLazySideInteraction' that stores the corresponding sum of 'globalIdsLazySideInteraction'
*/
- void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
- const std::vector<int>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding)
+ void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
+ const std::vector<mcIdType>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding)
{
- std::map<int,double> acc;
- std::vector<int>::const_iterator iter1=globalIdsLazySideInteraction.begin();
+ std::map<mcIdType,double> acc;
+ std::vector<mcIdType>::const_iterator iter1=globalIdsLazySideInteraction.begin();
std::vector<double>::const_iterator iter2=sumCorresponding.begin();
for(;iter1!=globalIdsLazySideInteraction.end();iter1++,iter2++)
acc[*iter1]=*iter2;
//
- int nbLazyProcs=globalIdsPartial.size();
- for(int i=0;i<nbLazyProcs;i++)
+ std::size_t nbLazyProcs=globalIdsPartial.size();
+ for(std::size_t i=0;i<nbLazyProcs;i++)
{
- const std::vector<int>& tmp1=globalIdsPartial[i];
+ const std::vector<mcIdType>& tmp1=globalIdsPartial[i];
std::vector<double>& tmp2=rowsPartialSumD[i];
- std::vector<int>::const_iterator iter3=tmp1.begin();
+ std::vector<mcIdType>::const_iterator iter3=tmp1.begin();
std::vector<double>::iterator iter4=tmp2.begin();
for(;iter3!=tmp1.end();iter3++,iter4++)
*iter4=acc[*iter3];
}
}
- void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD)
+ void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD)
{
- std::map<int,double> sum;
- std::vector< std::vector<int> >::const_iterator iter1=globalIdsPartial.begin();
+ std::map<mcIdType,double> sum;
+ std::vector< std::vector<mcIdType> >::const_iterator iter1=globalIdsPartial.begin();
std::vector< std::vector<double> >::iterator iter2=rowsPartialSumD.begin();
for(;iter1!=globalIdsPartial.end();iter1++,iter2++)
{
- std::vector<int>::const_iterator iter3=(*iter1).begin();
+ std::vector<mcIdType>::const_iterator iter3=(*iter1).begin();
std::vector<double>::const_iterator iter4=(*iter2).begin();
for(;iter3!=(*iter1).end();iter3++,iter4++)
sum[*iter3]+=*iter4;
iter2=rowsPartialSumD.begin();
for(iter1=globalIdsPartial.begin();iter1!=globalIdsPartial.end();iter1++,iter2++)
{
- std::vector<int>::const_iterator iter3=(*iter1).begin();
+ std::vector<mcIdType>::const_iterator iter3=(*iter1).begin();
std::vector<double>::iterator iter4=(*iter2).begin();
for(;iter3!=(*iter1).end();iter3++,iter4++)
*iter4=sum[*iter3];
* @param rowsPartialSumI input parameter : local ids of distant lazy procs elements in interaction with
* @param globalIdsPartial input parameter : global ids of distant lazy procs elements in interaction with
*/
- void InterpolationMatrix::mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<int> >& rowsPartialSumI,
- const std::vector<std::vector<int> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv)
+ void InterpolationMatrix::mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<mcIdType> >& rowsPartialSumI,
+ const std::vector<std::vector<mcIdType> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv)
{
//preparing fast access structures
std::map<int,int> procT;
int localProcId=0;
for(std::vector<int>::const_iterator iter1=procsInInteraction.begin();iter1!=procsInInteraction.end();iter1++,localProcId++)
procT[*iter1]=localProcId;
- int size=procsInInteraction.size();
- std::vector<std::map<int,int> > localToGlobal(size);
- for(int i=0;i<size;i++)
- {
- std::map<int,int>& myLocalToGlobal=localToGlobal[i];
- const std::vector<int>& locals=rowsPartialSumI[i];
- const std::vector<int>& globals=globalIdsPartial[i];
- std::vector<int>::const_iterator iter3=locals.begin();
- std::vector<int>::const_iterator iter4=globals.begin();
+ std::size_t size=procsInInteraction.size();
+ std::vector<std::map<mcIdType,mcIdType> > localToGlobal(size);
+ for(std::size_t i=0;i<size;i++)
+ {
+ std::map<mcIdType,mcIdType>& myLocalToGlobal=localToGlobal[i];
+ const std::vector<mcIdType>& locals=rowsPartialSumI[i];
+ const std::vector<mcIdType>& globals=globalIdsPartial[i];
+ std::vector<mcIdType>::const_iterator iter3=locals.begin();
+ std::vector<mcIdType>::const_iterator iter4=globals.begin();
for(;iter3!=locals.end();iter3++,iter4++)
myLocalToGlobal[*iter3]=*iter4;
}
//
- const vector<std::pair<int,int> >& mapping=_mapping.getSendingIds();
- std::map<int,double> globalIdVal;
+ const vector<std::pair<int,mcIdType> >& mapping=_mapping.getSendingIds();
+ std::map<mcIdType,double> globalIdVal;
//accumulate for same global id on lazy part.
for(vector<vector<pair<int,double> > >::iterator iter1=_coeffs.begin();iter1!=_coeffs.end();iter1++)
for(vector<pair<int,double> >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++)
{
- const std::pair<int,int>& distantLocalLazyId=mapping[(*iter2).first];
+ const std::pair<int,mcIdType>& distantLocalLazyId=mapping[(*iter2).first];
int localLazyProcId=procT[distantLocalLazyId.first];
- int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
+ mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
globalIdVal[globalDistantLazyId]+=(*iter2).second;
}
//perform merge
std::vector<double>::iterator iter4=(*iter3).begin();
for(vector<pair<int,double> >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter4++)
{
- const std::pair<int,int>& distantLocalLazyId=mapping[(*iter2).first];
+ const std::pair<int,mcIdType>& distantLocalLazyId=mapping[(*iter2).first];
int localLazyProcId=procT[distantLocalLazyId.first];
- int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
+ mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second];
double newVal=globalIdVal[globalDistantLazyId];
if((*iter2).second!=0.)
(*iter4)=val*newVal/(*iter2).second;
}
}
- void InterpolationMatrix::divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& resPerProcI,
+ void InterpolationMatrix::divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& resPerProcI,
const std::vector<std::vector<double> >& resPerProcD, std::vector<std::vector<double> >& deno)
{
- map<int,double> fastSums;
+ map<mcIdType,double> fastSums;
int procId=0;
for(vector<int>::const_iterator iter1=distantProcs.begin();iter1!=distantProcs.end();iter1++,procId++)
{
- const std::vector<int>& currentProcI=resPerProcI[procId];
+ const std::vector<mcIdType>& currentProcI=resPerProcI[procId];
const std::vector<double>& currentProcD=resPerProcD[procId];
vector<double>::const_iterator iter3=currentProcD.begin();
- for(vector<int>::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++)
+ for(vector<mcIdType>::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++)
fastSums[_col_offsets[std::make_pair(*iter1,*iter2)]]=*iter3;
}
deno.resize(_coeffs.size());
*/
void InterpolationMatrix::prepare()
{
- int nbelems = _source_field->getField()->getNumberOfTuples();
- for (int ielem=0; ielem < nbelems; ielem++)
+ mcIdType nbelems = _source_field->getField()->getNumberOfTuples();
+ for (mcIdType ielem=0; ielem < nbelems; ielem++)
{
_row_offsets[ielem+1]+=_row_offsets[ielem];
}
*/
void InterpolationMatrix::multiply(MEDCouplingFieldDouble& field) const
{
- int nbcomp = field.getArray()->getNumberOfComponents();
+ mcIdType nbcomp = ToIdType(field.getArray()->getNumberOfComponents());
vector<double> target_value(_col_offsets.size()* nbcomp,0.0);
//computing the matrix multiply on source side
if (_source_group.containsMyRank())
{
- int nbrows = _coeffs.size();
+ mcIdType nbrows = ToIdType(_coeffs.size());
// performing W.S
// W is the intersection matrix
// S is the source vector
- for (int irow=0; irow<nbrows; irow++)
+ for (mcIdType irow=0; irow<nbrows; irow++)
{
- for (int icomp=0; icomp< nbcomp; icomp++)
+ for (mcIdType icomp=0; icomp< nbcomp; icomp++)
{
double coeff_row = field.getIJ(irow,icomp);
- for (int icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
+ for (mcIdType icol=_row_offsets[irow]; icol< _row_offsets[irow+1];icol++)
{
int colid= _coeffs[irow][icol-_row_offsets[irow]].first;
double value = _coeffs[irow][icol-_row_offsets[irow]].second;
if (_target_group.containsMyRank())
{
- int nbelems = field.getArray()->getNumberOfTuples() ;
+ mcIdType nbelems = field.getArray()->getNumberOfTuples() ;
double* value = const_cast<double*> (field.getArray()->getPointer());
- for (int i=0; i<nbelems*nbcomp; i++)
+ for (mcIdType i=0; i<nbelems*nbcomp; i++)
{
value[i]=0.0;
}
*/
void InterpolationMatrix::transposeMultiply(MEDCouplingFieldDouble& field) const
{
- int nbcomp = field.getArray()->getNumberOfComponents();
+ std::size_t nbcomp = field.getArray()->getNumberOfComponents();
vector<double> source_value(_col_offsets.size()* nbcomp,0.0);
_mapping.reverseSendRecv(&source_value[0],field);
//treatment of the transpose matrix multiply on the source side
if (_source_group.containsMyRank())
{
- int nbrows = _coeffs.size();
- double *array = field.getArray()->getPointer() ;
+ mcIdType nbrows = ToIdType( _coeffs.size() );
+ double *array = field.getArray()->getPointer() ;
// Initialization
std::fill(array, array+nbrows*nbcomp, 0.0) ;
//performing WT.T
//WT is W transpose
//T is the target vector
- for (int irow = 0; irow < nbrows; irow++)
+ for (mcIdType irow = 0; irow < nbrows; irow++)
{
- for (int icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++)
+ for (mcIdType icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++)
{
int colid = _coeffs[irow][icol-_row_offsets[irow]].first;
double value = _coeffs[irow][icol-_row_offsets[irow]].second;
double deno = _deno_reverse_multiply[irow][icol-_row_offsets[irow]];
- for (int icomp=0; icomp<nbcomp; icomp++)
+ for (std::size_t icomp=0; icomp<nbcomp; icomp++)
{
double coeff_row = source_value[colid*nbcomp+icomp];
array[irow*nbcomp+icomp] += value*coeff_row/deno;
virtual ~InterpolationMatrix();
void addContribution(MEDCouplingPointSet& distant_support, int iproc_distant,
- const int* distant_elems, const std::string& srcMeth, const std::string& targetMeth);
+ const mcIdType* distant_elems, const std::string& srcMeth, const std::string& targetMeth);
void finishContributionW(ElementLocator& elementLocator);
void finishContributionL(ElementLocator& elementLocator);
void multiply(MEDCouplingFieldDouble& field) const;
void transposeMultiply(MEDCouplingFieldDouble& field)const;
void prepare();
- int getNbRows() const { return _row_offsets.size(); }
+ mcIdType getNbRows() const { return ToIdType(_row_offsets.size()); }
MPIAccessDEC* getAccessDEC() { return _mapping.getAccessDEC(); }
private:
void computeConservVolDenoW(ElementLocator& elementLocator);
void computeRevIntegralDenoL(ElementLocator& elementLocator);
void computeLocalColSum(std::vector<double>& res) const;
- void computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<int> >& resPerProcI,
+ void computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<mcIdType> >& resPerProcI,
std::vector<std::vector<double> >& resPerProcD) const;
void computeGlobalRowSum(ElementLocator& elementLocator, std::vector<std::vector<double> >& denoStrorage, std::vector<std::vector<double> >& denoStrorageInv);
void computeGlobalColSum(std::vector<std::vector<double> >& denoStrorage);
void resizeGlobalColSum(std::vector<std::vector<double> >& denoStrorage);
- void fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map<int,double> >& values, MEDCouplingFieldDouble *surf);
- void serializeMe(std::vector< std::vector< std::map<int,double> > >& data1, std::vector<int>& data2) const;
+ void fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map<mcIdType,double> >& values, MEDCouplingFieldDouble *surf);
+ void serializeMe(std::vector< std::vector< std::map<mcIdType,double> > >& data1, std::vector<int>& data2) const;
void initialize();
- void findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<int> >& elementsToAdd,
- const std::vector<std::vector<int> >& resPerProcI, const std::vector<std::vector<int> >& globalIdsPartial);
- void addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& elementsToAdd);
+ void findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<mcIdType> >& elementsToAdd,
+ const std::vector<std::vector<mcIdType> >& resPerProcI, const std::vector<std::vector<mcIdType> >& globalIdsPartial);
+ void addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& elementsToAdd);
int mergePolicies(const std::vector<int>& policyPartial);
- void mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<int> >& globalIdsPartial,
- std::vector<int>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding);
- void mergeRowSum2(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
- const std::vector<int>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding);
- void mergeRowSum3(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD);
- void mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<int> >& rowsPartialSumI,
- const std::vector<std::vector<int> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv);
- void divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& resPerProcI,
+ void mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<mcIdType> >& globalIdsPartial,
+ std::vector<mcIdType>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding);
+ void mergeRowSum2(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
+ const std::vector<mcIdType>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding);
+ void mergeRowSum3(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD);
+ void mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<mcIdType> >& rowsPartialSumI,
+ const std::vector<std::vector<mcIdType> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv);
+ void divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& resPerProcI,
const std::vector<std::vector<double> >& resPerProcD, std::vector<std::vector<double> >& deno);
private:
bool isSurfaceComputationNeeded(const std::string& method) const;
private:
const MEDCoupling::ParaFIELD *_source_field;
- std::vector<int> _row_offsets;
- std::map<std::pair<int,int>, int > _col_offsets;
+ std::vector<mcIdType> _row_offsets;
+ std::map<std::pair<int,mcIdType>, mcIdType > _col_offsets;
MEDCouplingPointSet *_source_support;
MxN_Mapping _mapping;
{
int size = 0;
for (int i = 0 ; i < _processor_group_size ; i++ )
- size += _send_requests[ i ].size() ;
+ size += (int)_send_requests[ i ].size() ;
return size ;
}
{
int size = 0 ;
for (int i = 0 ; i < _processor_group_size ; i++ )
- size += _recv_requests[ i ].size() ;
+ size += (int)_recv_requests[ i ].size() ;
return size ;
}
list< int >::const_iterator iter ;
for (iter = _send_requests[ destrank ].begin() ; iter != _send_requests[destrank].end() ; iter++ )
ArrayOfSendRequests[i++] = *iter ;
- return _send_requests[destrank].size() ;
+ return (int)_send_requests[destrank].size() ;
}
// Returns in ArrayOfRecvRequests with the dimension "size" all the
_recv_requests[ sourcerank ] ;
for (iter = _recv_requests[ sourcerank ].begin() ; iter != _recv_requests[sourcerank].end() ; iter++ )
ArrayOfRecvRequests[i++] = *iter ;
- return _recv_requests[sourcerank].size() ;
+ return (int)_recv_requests[sourcerank].size() ;
}
// Send in synchronous mode count values of type datatype from buffer to target
return aextent ;
}
+ // Returns the MPI size of a MPI_LONG
+ MPI_Aint MPIAccess::longExtent() const
+ {
+ MPI_Aint aextent, lbound ;
+ MPI_Type_get_extent( MPI_LONG , &lbound, &aextent ) ;
+ return aextent ;
+ }
+
// Returns the MPI size of a MPI_DOUBLE
MPI_Aint MPIAccess::doubleExtent() const
{
bool isTimeMessage( int MPITag ) const ;
MPI_Aint timeExtent() const ;
MPI_Aint intExtent() const ;
+ MPI_Aint longExtent() const ;
MPI_Aint doubleExtent() const ;
MPI_Aint extent( MPI_Datatype datatype ) const ;
// used to allocate ArrayOfSendRequests for the call to SendRequestIds
inline int MPIAccess::sendRequestIdsSize(int destrank)
{
- return _send_requests[destrank].size() ;
+ return (int)_send_requests[destrank].size() ;
}
// Returns the number of all RecvRequestIds matching a source rank. It may be
// used to allocate ArrayOfRecvRequests for the call to RecvRequestIds
inline int MPIAccess::recvRequestIdsSize(int sourcerank)
{
- return _recv_requests[sourcerank].size() ;
+ return (int)_recv_requests[sourcerank].size() ;
}
// Returns the MPI_Datatype (registered in MPI in the constructor with
return timeExtent() ;
if ( adatatype == MPI_INT )
return intExtent() ;
+ if ( adatatype == MPI_LONG )
+ return longExtent() ;
if ( adatatype == MPI_DOUBLE )
return doubleExtent() ;
return 0 ;
sts = _MPI_access->ISend( &((int *) sendbuf)[offset] , sendcount , sendtype ,
target , SendRequestId ) ;
}
+ else if ( sendtype == MPI_LONG )
+ {
+ sts = _MPI_access->ISend( &((long *) sendbuf)[offset] , sendcount , sendtype ,
+ target , SendRequestId ) ;
+ }
else
{
sts = _MPI_access->ISend( &((double *) sendbuf)[offset] , sendcount , sendtype ,
sts = _MPI_access->send( &((int *) sendbuf)[offset] , sendcount , sendtype ,
target , SendRequestId ) ;
}
+ else if ( sendtype == MPI_LONG )
+ {
+ sts = _MPI_access->send( &((long *) sendbuf)[offset] , sendcount , sendtype ,
+ target , SendRequestId ) ;
+ }
else
{
sts = _MPI_access->send( &((double *) sendbuf)[offset] , sendcount , sendtype ,
sts = _MPI_access->IRecv( &((int *) recvbuf)[offset] , recvcount , recvtype ,
target , RecvRequestId ) ;
}
+ else if ( recvtype == MPI_LONG )
+ {
+ sts = _MPI_access->IRecv( &((long *) recvbuf)[offset] , recvcount , recvtype ,
+ target , RecvRequestId ) ;
+ }
else
{
sts = _MPI_access->IRecv( &((double *) recvbuf)[offset] , recvcount , recvtype ,
sts = _MPI_access->recv( &((int *) recvbuf)[offset] , recvcount , recvtype ,
target , RecvRequestId ) ;
}
+ else if ( recvtype == MPI_LONG )
+ {
+ sts = _MPI_access->recv( &((long *) recvbuf)[offset] , recvcount , recvtype ,
+ target , RecvRequestId ) ;
+ }
else
{
sts = _MPI_access->recv( &((double *) recvbuf)[offset] , recvcount , recvtype ,
{
for ( target = 0 ; target < _group_size ; target++ )
{
- int recvsize = recvcount*_MPI_access->extent( recvtype ) ;
+ int recvsize = (int)(recvcount*_MPI_access->extent( recvtype ));
checkTime( recvcount , recvtype , target , false ) ;
//===========================================================================
//TODO : it is assumed actually that we have only 1 timestep before and after
{
if ( recvcounts[target] )
{
- int recvsize = recvcounts[target]*_MPI_access->extent( recvtype ) ;
+ int recvsize = (int)(recvcounts[target]*_MPI_access->extent( recvtype ));
checkTime( recvcounts[target] , recvtype , target , false ) ;
//===========================================================================
//TODO : it is assumed actually that we have only 1 timestep before nad after
throw INTERP_KERNEL::Exception("invalid rank in set<int> argument of MPIProcessorGroup constructor");
}
- _comm_interface.groupIncl(group_world, _proc_ids.size(), ranks, &_group);
+ _comm_interface.groupIncl(group_world, (int)_proc_ids.size(), ranks, &_group);
_comm_interface.commCreate(_world_comm, _group, &_comm);
\param distant_proc proc rank of the distant processor (in terms of the union group)
\param distant_element id of the element on the distant processor
*/
- void MxN_Mapping::addElementFromSource(int distant_proc, int distant_element)
+ void MxN_Mapping::addElementFromSource(int distant_proc, mcIdType distant_element)
{
_sending_ids.push_back(make_pair(distant_proc,distant_element));
for (int i=distant_proc; i<_union_group->size(); i++)
delete[] nbrecv;
_recv_ids.resize(_recv_proc_offsets[_union_group->size()]);
- int* isendbuf=0;
- int* irecvbuf=0;
+ mcIdType* isendbuf=0;
+ mcIdType* irecvbuf=0;
if (_sending_ids.size()>0)
- isendbuf = new int[_sending_ids.size()];
+ isendbuf = new mcIdType[_sending_ids.size()];
if (_recv_ids.size()>0)
- irecvbuf = new int[_recv_ids.size()];
+ irecvbuf = new mcIdType[_recv_ids.size()];
int* sendcounts = new int[_union_group->size()];
int* senddispls=new int[_union_group->size()];
int* recvcounts=new int[_union_group->size()];
recvdispls[i]=_recv_proc_offsets[i];
}
vector<int> offsets = _send_proc_offsets;
- for (int i=0; i<(int)_sending_ids.size();i++)
+ for (std::size_t i=0; i<_sending_ids.size();i++)
{
int iproc = _sending_ids[i].first;
isendbuf[offsets[iproc]]=_sending_ids[i].second;
offsets[iproc]++;
}
- comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_INT,
- irecvbuf, recvcounts, recvdispls, MPI_INT,
+ comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_ID_TYPE,
+ irecvbuf, recvcounts, recvdispls, MPI_ID_TYPE,
*comm);
for (int i=0; i< _recv_proc_offsets[_union_group->size()]; i++)
CommInterface comm_interface=_union_group->getCommInterface();
const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
- int nbcomp=field.getArray()->getNumberOfComponents();
+ int nbcomp=(int)field.getArray()->getNumberOfComponents();
double* sendbuf=0;
double* recvbuf=0;
if (_sending_ids.size() >0)
break;
case PointToPoint:
_access_DEC->allToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
- recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
+ recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
break;
}
CommInterface comm_interface=_union_group->getCommInterface();
const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
- int nbcomp=field.getArray()->getNumberOfComponents();
+ int nbcomp=(int)field.getArray()->getNumberOfComponents();
double* sendbuf=0;
double* recvbuf=0;
if (_recv_ids.size() >0)
public:
MxN_Mapping(const ProcessorGroup& source_group, const ProcessorGroup& target_group, const DECOptions& dec_options);
virtual ~MxN_Mapping();
- void addElementFromSource(int distant_proc, int distant_elem);
+ void addElementFromSource(int distant_proc, mcIdType distant_elem);
void prepareSendRecv();
void sendRecv(MEDCouplingFieldDouble& field);
void sendRecv(double* sendfield, MEDCouplingFieldDouble& field) const ;
void reverseSendRecv(double* recvfield, MEDCouplingFieldDouble& field) const ;
//
- const std::vector<std::pair<int,int> >& getSendingIds() const { return _sending_ids; }
+ const std::vector<std::pair<int,mcIdType> >& getSendingIds() const { return _sending_ids; }
const std::vector<int>& getSendProcsOffsets() const { return _send_proc_offsets; }
void initialize();
ProcessorGroup* _union_group;
MPIAccessDEC * _access_DEC;
int _nb_comps;
- std::vector<std::pair<int,int> > _sending_ids;
- std::vector<int> _recv_ids;
+ std::vector<std::pair<int,mcIdType> > _sending_ids;
+ std::vector<mcIdType> _recv_ids;
std::vector<int> _send_proc_offsets;
std::vector<int> _recv_proc_offsets;
};
OverlapDEC::OverlapDEC(const std::set<int>& procIds, const MPI_Comm& world_comm):
_load_balancing_algo(1),
_own_group(true),_interpolation_matrix(0), _locator(0),
+ _default_field_value(0.0),
_source_field(0),_own_source_field(false),
_target_field(0),_own_target_field(false),
- _default_field_value(0.0),
_comm(MPI_COMM_NULL)
{
MEDCoupling::CommInterface comm;
std::copy(procIds.begin(),procIds.end(),ranks_world);
MPI_Group group,world_group;
comm.commGroup(world_comm,&world_group);
- comm.groupIncl(world_group,procIds.size(),ranks_world,&group);
+ comm.groupIncl(world_group,(int)procIds.size(),ranks_world,&group);
delete [] ranks_world;
comm.commCreate(world_comm,group,&_comm);
comm.groupFree(&group);
return ;
}
std::set<int> idsUnion;
- for(std::size_t i=0;i<procIds.size();i++)
+ for(unsigned int i=0;i<procIds.size();i++)
idsUnion.insert(i);
_group=new MPIProcessorGroup(comm,idsUnion,_comm);
}
for(std::vector< std::pair<int,int> >::const_iterator it=jobs.begin();it!=jobs.end();it++)
{
const MEDCouplingPointSet *src=_locator->getSourceMesh((*it).first);
- const DataArrayInt *srcIds=_locator->getSourceIds((*it).first);
+ const DataArrayIdType *srcIds=_locator->getSourceIds((*it).first);
const MEDCouplingPointSet *trg=_locator->getTargetMesh((*it).second);
- const DataArrayInt *trgIds=_locator->getTargetIds((*it).second);
+ const DataArrayIdType *trgIds=_locator->getTargetIds((*it).second);
_interpolation_matrix->computeLocalIntersection(src,srcIds,srcMeth,(*it).first,trg,trgIds,trgMeth,(*it).second);
}
_interpolation_matrix->prepare(_locator->getProcsToSendFieldData());
_local_source_mesh(0),
_local_target_mesh(0),
_domain_bounding_boxes(0),
- _group(group),
- _epsAbs(epsAbs)
+ _epsAbs(epsAbs),
+ _group(group)
{
if(_local_source_field)
_local_source_mesh=_local_source_field->getSupport()->getCellMesh();
else
{
if(cpl.first == procID)
- (*itMap).second = full_set[cpl.second].size();
+ (*itMap).second = (int)full_set[cpl.second].size();
else // cpl.second == srcProcID
- (*itMap).second = full_set[cpl.first].size();
+ (*itMap).second = (int)full_set[cpl.first].size();
}
}
INTERP_KERNEL::AutoPtr<bool> proc_valid = new bool[grp_size];
int max_sz = -1, max_id = -1;
for(itVector = full_set.begin(), procID=0; itVector != full_set.end(); itVector++, procID++)
{
- int sz = (*itVector).size();
+ int sz = (int)(*itVector).size();
if (proc_valid[procID] && sz > max_sz)
{
max_sz = sz;
return (*it).second;
}
- const DataArrayInt *OverlapElementLocator::getSourceIds(int procId) const
+ const DataArrayIdType *OverlapElementLocator::getSourceIds(int procId) const
{
int myProcId=_group.myRank();
if(myProcId==procId)
return (*it).second;
}
- const DataArrayInt *OverlapElementLocator::getTargetIds(int procId) const
+ const DataArrayIdType *OverlapElementLocator::getTargetIds(int procId) const
{
int myProcId=_group.myRank();
if(myProcId==procId)
field=_local_target_field;
}
AutoDAInt elems=local_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment());
- DataArrayInt *old2new_map;
+ DataArrayIdType *old2new_map;
MEDCouplingPointSet *send_mesh=static_cast<MEDCouplingPointSet *>(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map));
if(sourceOrTarget)
matrix.keepTracksOfSourceIds(procId,old2new_map);
*/
void OverlapElementLocator::receiveRemoteMeshFrom(int procId, bool sourceOrTarget)
{
- DataArrayInt *old2new_map=0;
+ DataArrayIdType *old2new_map=0;
MEDCouplingPointSet *m=0;
receiveMesh(procId,m,old2new_map);
Proc_SrcOrTgt p(procId,sourceOrTarget);
_remote_elems[p]=old2new_map;
}
- void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const
+ void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const
{
CommInterface comInterface=_group.getCommInterface();
// First stage : exchanging sizes
vector<double> tinyInfoLocalD;//tinyInfoLocalD not used for the moment
- vector<int> tinyInfoLocal;
+ vector<mcIdType> tinyInfoLocal;
vector<string> tinyInfoLocalS;
mesh->getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
const MPI_Comm *comm=getCommunicator();
//
- int lgth[2];
- lgth[0]=tinyInfoLocal.size();
+ mcIdType lgth[2];
+ lgth[0]=ToIdType(tinyInfoLocal.size());
lgth[1]=idsToSend->getNbOfElems();
- comInterface.send(&lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm);
- comInterface.send(&tinyInfoLocal[0],tinyInfoLocal.size(),MPI_INT,procId,START_TAG_MESH_XCH+1,*comm);
+ comInterface.send(&lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm);
+ comInterface.send(&tinyInfoLocal[0],(int)tinyInfoLocal.size(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm);
//
- DataArrayInt *v1Local=0;
+ DataArrayIdType *v1Local=0;
DataArrayDouble *v2Local=0;
mesh->serialize(v1Local,v2Local);
- comInterface.send(v1Local->getPointer(),v1Local->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm);
- comInterface.send(v2Local->getPointer(),v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm);
+ comInterface.send(v1Local->getPointer(),(int)v1Local->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm);
+ comInterface.send(v2Local->getPointer(),(int)v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm);
//finished for mesh, ids now
- comInterface.send(const_cast<int *>(idsToSend->getConstPointer()),lgth[1],MPI_INT,procId,START_TAG_MESH_XCH+4,*comm);
+ comInterface.send(const_cast<mcIdType *>(idsToSend->getConstPointer()),(int)lgth[1],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+4,*comm);
//
v1Local->decrRef();
v2Local->decrRef();
}
- void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const
+ void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const
{
- int lgth[2];
+ mcIdType lgth[2];
MPI_Status status;
const MPI_Comm *comm=getCommunicator();
CommInterface comInterface=_group.getCommInterface();
- comInterface.recv(lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm,&status);
- std::vector<int> tinyInfoDistant(lgth[0]);
- ids=DataArrayInt::New();
+ comInterface.recv(lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm,&status);
+ std::vector<mcIdType> tinyInfoDistant(lgth[0]);
+ ids=DataArrayIdType::New();
ids->alloc(lgth[1],1);
- comInterface.recv(&tinyInfoDistant[0],lgth[0],MPI_INT,procId,START_TAG_MESH_XCH+1,*comm,&status);
+ comInterface.recv(&tinyInfoDistant[0],(int)lgth[0],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm,&status);
mesh=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]);
std::vector<std::string> unusedTinyDistantSts;
vector<double> tinyInfoDistantD(1);//tinyInfoDistantD not used for the moment
- DataArrayInt *v1Distant=DataArrayInt::New();
+ DataArrayIdType *v1Distant=DataArrayIdType::New();
DataArrayDouble *v2Distant=DataArrayDouble::New();
mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
- comInterface.recv(v1Distant->getPointer(),v1Distant->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm,&status);
- comInterface.recv(v2Distant->getPointer(),v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status);
+ comInterface.recv(v1Distant->getPointer(),(int)v1Distant->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm,&status);
+ comInterface.recv(v2Distant->getPointer(),(int)v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status);
mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
//finished for mesh, ids now
- comInterface.recv(ids->getPointer(),lgth[1],MPI_INT,procId,1144,*comm,&status);
+ comInterface.recv(ids->getPointer(),(int)lgth[1],MPI_ID_TYPE,procId,1144,*comm,&status);
//
v1Distant->decrRef();
v2Distant->decrRef();
std::string getSourceMethod() const;
std::string getTargetMethod() const;
const MEDCouplingPointSet *getSourceMesh(int procId) const;
- const DataArrayInt *getSourceIds(int procId) const;
+ const DataArrayIdType *getSourceIds(int procId) const;
const MEDCouplingPointSet *getTargetMesh(int procId) const;
- const DataArrayInt *getTargetIds(int procId) const;
+ const DataArrayIdType *getTargetIds(int procId) const;
bool isInMyTodoList(int i, int j) const;
void debugPrintWorkSharing(std::ostream & ostr) const;
private:
bool intersectsBoundingBox(int i, int j) const;
void sendLocalMeshTo(int procId, bool sourceOrTarget, OverlapInterpolationMatrix& matrix) const;
void receiveRemoteMeshFrom(int procId, bool sourceOrTarget);
- void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const;
- void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const;
+ void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const;
+ void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const;
private:
typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet;
- typedef MCAuto< DataArrayInt > AutoDAInt;
+ typedef MCAuto< DataArrayIdType > AutoDAInt;
typedef std::pair<int,bool> Proc_SrcOrTgt; // a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field
static const int START_TAG_MESH_XCH;
{
}
- void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayInt *ids)
+ void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayIdType *ids)
{
_mapping.keepTracksOfSourceIds(procId,ids);
}
- void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayInt *ids)
+ void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayIdType *ids)
{
_mapping.keepTracksOfTargetIds(procId,ids);
}
*
* One of the 2 is necessarily null (the two can be null together)
*/
- void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId,
- const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId)
+ void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId,
+ const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId)
{
std::string interpMethod(srcMeth);
interpMethod+=trgMeth;
//creating the interpolator structure
vector<SparseDoubleVec > sparse_matrix_part;
- int colSize=0;
+ mcIdType colSize=0;
//computation of the intersection volumes between source and target elements
const MEDCouplingUMesh *trgC=dynamic_cast<const MEDCouplingUMesh *>(trg);
const MEDCouplingUMesh *srcC=dynamic_cast<const MEDCouplingUMesh *>(src);
vector<SparseDoubleVec > matrixTranspose;
colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,sparse_matrix_part,interpMethod);//not a bug target in source.
TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part);
- colSize=matrixTranspose.size();
+ colSize=ToIdType(matrixTranspose.size());
}
else if ( src->getMeshDimension() == 1 && trg->getMeshDimension() == 2
&& trg->getSpaceDimension() == 2 && src->getSpaceDimension() == 2 )
vector<SparseDoubleVec > matrixTranspose;
colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,matrixTranspose,interpMethod);//not a bug target in source.
TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part);
- colSize=matrixTranspose.size();
+ colSize=ToIdType(matrixTranspose.size());
}
else if (trg->getMeshDimension() != _source_support->getMeshDimension())
{
}
void OverlapInterpolationMatrix::TransposeMatrix(const std::vector<SparseDoubleVec >& matIn,
- int nbColsMatIn, std::vector<SparseDoubleVec >& matOut)
+ mcIdType nbColsMatIn, std::vector<SparseDoubleVec >& matOut)
{
matOut.resize(nbColsMatIn);
int id=0;
const InterpolationOptions& i_opt,
const OverlapElementLocator & loc);
- void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
+ void keepTracksOfSourceIds(int procId, DataArrayIdType *ids);
- void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
+ void keepTracksOfTargetIds(int procId, DataArrayIdType *ids);
- void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId,
- const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId);
+ void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId,
+ const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId);
void prepare(const std::vector< int > & procsToSendField);
virtual ~OverlapInterpolationMatrix();
private:
- static void TransposeMatrix(const std::vector<SparseDoubleVec>& matIn, int nbColsMatIn,
+ static void TransposeMatrix(const std::vector<SparseDoubleVec>& matIn, mcIdType nbColsMatIn,
std::vector<SparseDoubleVec>& matOut);
private:
ParaFIELD *_source_field;
/*!
* Keeps the link between a given a proc holding source mesh data, and the corresponding cell IDs.
*/
-void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayInt *ids)
+void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayIdType *ids)
{
ids->incrRef();
_sent_src_ids[procId] = ids;
/*!
* Same as keepTracksOfSourceIds() but for target mesh data.
*/
-void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayInt *ids)
+void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayIdType *ids)
{
ids->incrRef();
_sent_trg_ids[procId] = ids;
*
* One of the 2 is necessarily null (the two can be null together)
*/
-void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId)
+void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId)
{
_matrixes_st.push_back(matrixST);
_source_proc_id_st.push_back(srcProcId);
_nb_of_rcv_src_ids[srcProcId] = srcIds->getNumberOfTuples();
else // source mesh part is local
{
- std::set<int> s;
+ std::set<mcIdType> s;
// For all source IDs (=col indices) in the sparse matrix:
for(std::vector< SparseDoubleVec >::const_iterator it1=matrixST.begin();it1!=matrixST.end();it1++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
s.insert((*it2).first);
- vector<int> v(s.begin(), s.end()); // turn set into vector
+ vector<mcIdType> v(s.begin(), s.end()); // turn set into vector
_src_ids_zip_comp[trgProcId] = v;
}
}
*
* After the call of this method, 'this' contains the matrixST for all source cells of the current proc
*/
-void OverlapMapping::prepare(const std::vector< int >& procsToSendField, int nbOfTrgElems)
+void OverlapMapping::prepare(const std::vector< int >& procsToSendField, mcIdType nbOfTrgElems)
{
#ifdef DEC_DEBUG
printMatrixesST();
CommInterface commInterface=_group.getCommInterface();
const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group);
const MPI_Comm *comm=group->getComm();
- int grpSize=_group.size();
- INTERP_KERNEL::AutoPtr<int> nbsend=new int[grpSize];
+ std::size_t grpSize=_group.size();
+ INTERP_KERNEL::AutoPtr<mcIdType> nbsend=new mcIdType[grpSize];
INTERP_KERNEL::AutoPtr<int> nbsend2=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbsend3=new int[grpSize];
- std::fill<int *>(nbsend,nbsend+grpSize,0);
+ std::fill<mcIdType *>(nbsend,nbsend+grpSize,0);
int myProcId=_group.myRank();
for(std::size_t i=0;i<_matrixes_st.size();i++)
if(_source_proc_id_st[i]==myProcId)
- nbsend[_target_proc_id_st[i]]=_matrixes_st[i].size();
- INTERP_KERNEL::AutoPtr<int> nbrecv=new int[grpSize];
- commInterface.allToAll(nbsend,1,MPI_INT,nbrecv,1,MPI_INT,*comm);
+ nbsend[_target_proc_id_st[i]]=(int)_matrixes_st[i].size();
+ INTERP_KERNEL::AutoPtr<mcIdType> nbrecv=new mcIdType[grpSize];
+ commInterface.allToAll(nbsend,1,MPI_ID_TYPE,nbrecv,1,MPI_ID_TYPE,*comm);
//exchanging matrix
//first exchanging offsets+ids_source
INTERP_KERNEL::AutoPtr<int> nbrecv1=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbrecv2=new int[grpSize];
//
- int *tmp=0;
+ mcIdType *tmp=0;
serializeMatrixStep0ST(nbrecv,
tmp,nbsend2,nbsend3,
nbrecv1,nbrecv2);
- INTERP_KERNEL::AutoPtr<int> bigArr=tmp;
- INTERP_KERNEL::AutoPtr<int> bigArrRecv=new int[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]];
- commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_INT,
- bigArrRecv,nbrecv1,nbrecv2,MPI_INT,
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArr=tmp;
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArrRecv=new mcIdType[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]];
+ commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_ID_TYPE,
+ bigArrRecv,nbrecv1,nbrecv2,MPI_ID_TYPE,
*comm);// sending ids of sparse matrix (n+1 elems)
//second phase echange target ids
std::fill<int *>(nbsend2,nbsend2+grpSize,0);
INTERP_KERNEL::AutoPtr<int> nbrecv3=new int[grpSize];
INTERP_KERNEL::AutoPtr<int> nbrecv4=new int[grpSize];
double *tmp2=0;
- int lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2,
+ mcIdType lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2,
tmp,tmp2,
nbsend2,nbsend3,nbrecv3,nbrecv4);
- INTERP_KERNEL::AutoPtr<int> bigArr2=tmp;
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArr2=tmp;
INTERP_KERNEL::AutoPtr<double> bigArrD2=tmp2;
- INTERP_KERNEL::AutoPtr<int> bigArrRecv2=new int[lgthOfArr];
+ INTERP_KERNEL::AutoPtr<mcIdType> bigArrRecv2=new mcIdType[lgthOfArr];
INTERP_KERNEL::AutoPtr<double> bigArrDRecv2=new double[lgthOfArr];
- commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_INT,
- bigArrRecv2,nbrecv3,nbrecv4,MPI_INT,
+ commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_ID_TYPE,
+ bigArrRecv2,nbrecv3,nbrecv4,MPI_ID_TYPE,
*comm);
commInterface.allToAllV(bigArrD2,nbsend2,nbsend3,MPI_DOUBLE,
bigArrDRecv2,nbrecv3,nbrecv4,MPI_DOUBLE,
/*!
* Compute denominators for ConvervativeVolumic interp.
*/
-void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg)
+void OverlapMapping::computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg)
{
int myProcId=_group.myRank();
//
{
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
int curSrcId=_the_matrix_st_source_proc_id[i];
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
- int rowId=0;
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
+ mcIdType rowId=0;
if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId) // Local computation: simple, because rowId of mat are directly target cell ids.
{
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
}
else // matrix was received, remote computation
{
- const DataArrayInt *trgIds = (*isItem1).second;
- const int *trgIds2=trgIds->getConstPointer();
+ const DataArrayIdType *trgIds = (*isItem1).second;
+ const mcIdType *trgIds2=trgIds->getConstPointer();
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
deno[trgIds2[rowId]]+=(*it2).second;
// Broadcast the vector into a structure similar to the initial sparse matrix of numerators:
for(std::size_t i=0;i<sz1;i++)
{
- int rowId=0;
+ mcIdType rowId=0;
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
int curSrcId=_the_matrix_st_source_proc_id[i];
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
std::vector< SparseDoubleVec >& denoM=_the_deno_st[i];
denoM.resize(mat.size());
if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId)//item1 of step2 main algo. Simple, because rowId of mat are directly target ids.
{
- int rowId=0;
+ mcIdType rowId=0;
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
denoM[rowId][(*it2).first]=deno[rowId];
}
else
{
- const DataArrayInt *trgIds = (*isItem1).second;
- const int *trgIds2=trgIds->getConstPointer();
+ const DataArrayIdType *trgIds = (*isItem1).second;
+ const mcIdType *trgIds2=trgIds->getConstPointer();
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
denoM[rowId][(*it2).first]=deno[trgIds2[rowId]];
* \param offsets tells for a proc i where to start serialize#0 matrix. size equal to _group.size().
* \param nbOfElemsSrc of size _group.size(). Comes from previous all2all call. tells how many srcIds per proc contains matrix for current proc.
*/
-void OverlapMapping::serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets,
+void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets,
int *countForRecv, int *offsetsForRecv) const
{
- int grpSize=_group.size();
+ std::size_t grpSize=_group.size();
std::fill<int *>(count,count+grpSize,0);
- int szz=0;
+ std::size_t szz=0;
int myProcId=_group.myRank();
for(std::size_t i=0;i<_matrixes_st.size();i++)
{
if(_source_proc_id_st[i]==myProcId)// && _target_proc_id_st[i]!=myProcId
{
- count[_target_proc_id_st[i]]=_matrixes_st[i].size()+1;
+ count[_target_proc_id_st[i]]=(int)_matrixes_st[i].size()+1;
szz+=_matrixes_st[i].size()+1;
}
}
- bigArr=new int[szz];
+ bigArr=new mcIdType[szz];
offsets[0]=0;
- for(int i=1;i<grpSize;i++)
+ for(std::size_t i=1;i<grpSize;i++)
offsets[i]=offsets[i-1]+count[i-1];
for(std::size_t i=0;i<_matrixes_st.size();i++)
{
if(_source_proc_id_st[i]==myProcId)
{
- int start=offsets[_target_proc_id_st[i]];
- int *work=bigArr+start;
+ mcIdType start=offsets[_target_proc_id_st[i]];
+ mcIdType *work=bigArr+start;
*work=0;
const std::vector< SparseDoubleVec >& mat=_matrixes_st[i];
for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++,work++)
- work[1]=work[0]+(*it).size();
+ work[1]=work[0]+ToIdType((*it).size());
}
}
//
offsetsForRecv[0]=0;
- for(int i=0;i<grpSize;i++)
+ for(std::size_t i=0;i<grpSize;i++)
{
if(nbOfElemsSrc[i]>0)
- countForRecv[i]=nbOfElemsSrc[i]+1;
+ countForRecv[i]=(int)nbOfElemsSrc[i]+1;
else
countForRecv[i]=0;
if(i>0)
* This method performs step#1 and step#2/3. It returns the size of expected array to get allToAllV.
* It is where the locally computed matrices are serialized to be sent to adequate final proc.
*/
-int OverlapMapping::serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0,
- int *&bigArrI, double *&bigArrD, int *count, int *offsets,
+mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0,
+ mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets,
int *countForRecv, int *offsForRecv) const
{
- int grpSize=_group.size();
+ std::size_t grpSize=_group.size();
int myProcId=_group.myRank();
offsForRecv[0]=0;
- int szz=0;
- for(int i=0;i<grpSize;i++)
+ mcIdType szz=0;
+ for(std::size_t i=0;i<grpSize;i++)
{
if(nbOfElemsSrc[i]!=0)
- countForRecv[i]=recvStep0[offsStep0[i]+nbOfElemsSrc[i]];
+ countForRecv[i]=(int)recvStep0[offsStep0[i]+nbOfElemsSrc[i]];
else
countForRecv[i]=0;
szz+=countForRecv[i];
//
std::fill(count,count+grpSize,0);
offsets[0]=0;
- int fullLgth=0;
+ std::size_t fullLgth=0;
for(std::size_t i=0;i<_matrixes_st.size();i++)
{
if(_source_proc_id_st[i]==myProcId)
{
const std::vector< SparseDoubleVec >& mat=_matrixes_st[i];
- int lgthToSend=0;
+ mcIdType lgthToSend=0;
for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++)
- lgthToSend+=(*it).size();
- count[_target_proc_id_st[i]]=lgthToSend;
+ lgthToSend+=ToIdType((*it).size());
+ count[_target_proc_id_st[i]]=(int)lgthToSend;
fullLgth+=lgthToSend;
}
}
- for(int i=1;i<grpSize;i++)
+ for(std::size_t i=1;i<grpSize;i++)
offsets[i]=offsets[i-1]+count[i-1];
//
- bigArrI=new int[fullLgth];
+ bigArrI=new mcIdType[fullLgth];
bigArrD=new double[fullLgth];
// feeding arrays
fullLgth=0;
const std::vector< SparseDoubleVec >& mat=_matrixes_st[i];
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++)
{
- int j=0;
+ mcIdType j=0;
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++,j++)
{
bigArrI[fullLgth+j]=(*it2).first;
* - The second is the pseudo id of source proc (correspondence with true id is in attribute _the_matrix_st_source_proc_id and _the_matrix_st_source_ids)
* - the third is the srcId in the pseudo source proc
*/
-void OverlapMapping::unserializationST(int nbOfTrgElems,
- const int *nbOfElemsSrcPerProc,//first all2all
- const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all
- const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls
+void OverlapMapping::unserializationST(mcIdType nbOfTrgElems,
+ const mcIdType *nbOfElemsSrcPerProc,//first all2all
+ const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all
+ const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls
{
_the_matrix_st.clear();
_the_matrix_st_source_proc_id.clear();
//
- int grpSize=_group.size();
- for(int i=0;i<grpSize;i++)
+ std::size_t grpSize=_group.size();
+ for(unsigned int i=0;i<grpSize;i++)
if(nbOfElemsSrcPerProc[i]!=0)
_the_matrix_st_source_proc_id.push_back(i);
- int nbOfPseudoProcs=_the_matrix_st_source_proc_id.size();//_the_matrix_st_target_proc_id.size() contains number of matrix fetched remotely whose sourceProcId==myProcId
+ std::size_t nbOfPseudoProcs=_the_matrix_st_source_proc_id.size();//_the_matrix_st_target_proc_id.size() contains number of matrix fetched remotely whose sourceProcId==myProcId
_the_matrix_st.resize(nbOfPseudoProcs);
//
- int j=0;
- for(int i=0;i<grpSize;i++)
+ std::size_t j=0;
+ for(std::size_t i=0;i<grpSize;i++)
if(nbOfElemsSrcPerProc[i]!=0)
{
_the_matrix_st[j].resize(nbOfElemsSrcPerProc[i]);
- for(int k=0;k<nbOfElemsSrcPerProc[i];k++)
+ for(mcIdType k=0;k<nbOfElemsSrcPerProc[i];k++)
{
- int offs=bigArrRecv[bigArrRecvOffs[i]+k];
- int lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs;
- for(int l=0;l<lgthOfMap;l++)
+ mcIdType offs=bigArrRecv[bigArrRecvOffs[i]+k];
+ mcIdType lgthOfMap=bigArrRecv[bigArrRecvOffs[i]+k+1]-offs;
+ for(mcIdType l=0;l<lgthOfMap;l++)
_the_matrix_st[j][k][bigArrRecv2[bigArrRecv2Offs[i]+offs+l]]=bigArrDRecv2[bigArrRecv2Offs[i]+offs+l];
}
j++;
void OverlapMapping::finishToFillFinalMatrixST()
{
int myProcId=_group.myRank();
- int sz=_matrixes_st.size();
+ std::size_t sz=_matrixes_st.size();
int nbOfEntryToAdd=0;
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
if(_source_proc_id_st[i]!=myProcId)
nbOfEntryToAdd++;
if(nbOfEntryToAdd==0)
return ;
- int oldNbOfEntry=_the_matrix_st.size();
- int newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd;
+ std::size_t oldNbOfEntry=_the_matrix_st.size();
+ std::size_t newNbOfEntry=oldNbOfEntry+nbOfEntryToAdd;
_the_matrix_st.resize(newNbOfEntry);
- int j=oldNbOfEntry;
- for(int i=0;i<sz;i++)
+ std::size_t j=oldNbOfEntry;
+ for(std::size_t i=0;i<sz;i++)
if(_source_proc_id_st[i]!=myProcId)
{
const std::vector<SparseDoubleVec >& mat=_matrixes_st[i];
{
using namespace std;
- int nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test
+ std::size_t nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test
CommInterface commInterface=_group.getCommInterface();
const MPIProcessorGroup *group=static_cast<const MPIProcessorGroup*>(&_group);
const MPI_Comm *comm=group->getComm();
MCAuto<DataArrayDouble> vals;
if(_locator.isInMyTodoList(myProcID, procID))
{
- map<int, vector<int> >::const_iterator isItem11 = _src_ids_zip_comp.find(procID);
+ map<int, vector<mcIdType> >::const_iterator isItem11 = _src_ids_zip_comp.find(procID);
if (isItem11 == _src_ids_zip_comp.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _src_ids_zip_comp!");
- const vector<int> & v = (*isItem11).second;
- int sz = v.size();
+ const vector<mcIdType> & v = (*isItem11).second;
+ std::size_t sz = v.size();
vals=fieldInput->getArray()->selectByTupleId(&(v[0]),&(v[0])+sz);
}
else
{
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem11 = _sent_src_ids.find( procID );
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem11 = _sent_src_ids.find( procID );
if (isItem11 == _sent_src_ids.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _sent_src_ids!");
vals=fieldInput->getArray()->selectByTupleId(*(*isItem11).second);
}
- nbsend[procID] = vals->getNbOfElems();
+ nbsend[procID] = (int)vals->getNbOfElems();
valsToSend.insert(valsToSend.end(),vals->getConstPointer(),vals->getConstPointer()+nbsend[procID]);
}
{
if(_locator.isInMyTodoList(procID, myProcID))
{
- map <int,int>::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID);
+ map <int,mcIdType>::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID);
if (isItem11 == _nb_of_rcv_src_ids.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _nb_of_rcv_src_ids!");
- nbrecv[procID] = (*isItem11).second;
+ nbrecv[procID] = (int)((*isItem11).second);
}
else
{
- map<int, vector<int> >::const_iterator isItem11 = _src_ids_zip_recv.find(procID);
+ map<int, vector<mcIdType> >::const_iterator isItem11 = _src_ids_zip_recv.find(procID);
if (isItem11 == _src_ids_zip_recv.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _src_ids_zip_recv!");
- nbrecv[procID] = (*isItem11).second.size()*nbOfCompo;
+ nbrecv[procID] = (int)((*isItem11).second.size()*nbOfCompo);
}
}
}
// For each source processor corresponding to a locally held matrix:
{
int srcProcID = *itProc;
- int id = distance(_the_matrix_st_source_proc_id.begin(),itProc);
+ std::size_t id = std::distance(_the_matrix_st_source_proc_id.begin(),itProc);
const vector< SparseDoubleVec >& mat =_the_matrix_st[id];
const vector< SparseDoubleVec >& deno = _the_deno_st[id];
*/
if (srcProcID == myProcID)
{
- int nbOfTrgTuples=mat.size();
+ std::size_t nbOfTrgTuples=mat.size();
double * targetBase = fieldOutput->getArray()->getPointer();
- for(int j=0; j<nbOfTrgTuples; j++)
+ for(std::size_t j=0; j<nbOfTrgTuples; j++)
{
const SparseDoubleVec& mat1=mat[j];
const SparseDoubleVec& deno1=deno[j];
if(!_locator.isInMyTodoList(srcProcID, myProcID))
{
// invert _src_ids_zip_recv
- map<int,int> revert_zip;
- map<int, vector<int> >::const_iterator it11= _src_ids_zip_recv.find(srcProcID);
+ map<mcIdType,int> revert_zip;
+ map<int, vector<mcIdType> >::const_iterator it11= _src_ids_zip_recv.find(srcProcID);
if (it11 == _src_ids_zip_recv.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _src_ids_zip_recv!");
- const vector<int> & vec = (*it11).second;
+
+ const vector<mcIdType> & vec = (*it11).second;
int newId=0;
- for(vector<int>::const_iterator it=vec.begin();it!=vec.end();it++,newId++)
+ for(vector<mcIdType>::const_iterator it=vec.begin();it!=vec.end();it++,newId++)
revert_zip[*it]=newId;
- map < int, MCAuto<DataArrayInt> >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID);
+ map < int, MCAuto<DataArrayIdType> >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID);
if (isItem24 == _sent_trg_ids.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _sent_trg_ids!");
- const DataArrayInt *tgrIdsDA = (*isItem24).second;
- const int *tgrIds = tgrIdsDA->getConstPointer();
+ const DataArrayIdType *tgrIdsDA = (*isItem24).second;
+ const mcIdType *tgrIds = tgrIdsDA->getConstPointer();
- int nbOfTrgTuples=mat.size();
+ std::size_t nbOfTrgTuples=mat.size();
double * targetBase = fieldOutput->getArray()->getPointer();
- for(int j=0;j<nbOfTrgTuples;j++)
+ for(std::size_t j=0;j<nbOfTrgTuples;j++)
{
const SparseDoubleVec& mat1=mat[j];
const SparseDoubleVec& deno1=deno[j];
double * targetPt = targetBase+tgrIds[j]*nbOfCompo;
for(SparseDoubleVec::const_iterator it3=mat1.begin();it3!=mat1.end();it3++,it5++)
{
- map<int,int>::const_iterator it4=revert_zip.find((*it3).first);
+ map<mcIdType,int>::const_iterator it4=revert_zip.find((*it3).first);
if(it4==revert_zip.end())
throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in revert_zip!");
double ratio = (*it3).second/(*it5).second;
*/
{
// Same loop as in the case srcProcID == myProcID, except that instead of working on local field data, we work on bigArr
- int nbOfTrgTuples=mat.size();
+ std::size_t nbOfTrgTuples=mat.size();
double * targetBase = fieldOutput->getArray()->getPointer();
- for(int j=0;j<nbOfTrgTuples;j++)
+ for(std::size_t j=0;j<nbOfTrgTuples;j++)
{
const SparseDoubleVec& mat1=mat[j];
const SparseDoubleVec& deno1=deno[j];
CommInterface commInterface=_group.getCommInterface();
int myProcId=_group.myRank();
- int nbOfMatrixRecveived=_the_matrix_st_source_proc_id.size();
- for(int i=0;i<nbOfMatrixRecveived;i++)
+ std::size_t nbOfMatrixRecveived=_the_matrix_st_source_proc_id.size();
+ for(std::size_t i=0;i<nbOfMatrixRecveived;i++)
{
int curSrcProcId=_the_matrix_st_source_proc_id[i];
if(curSrcProcId!=myProcId) // if =, data has been populated by addContributionST()
{
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
- std::set<int> s;
+ std::set<mcIdType> s;
for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++)
for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
s.insert((*it2).first);
- vector<int> vec(s.begin(),s.end());
+ vector<mcIdType> vec(s.begin(),s.end());
_src_ids_zip_recv[curSrcProcId] = vec;
}
}
class MEDCouplingFieldDouble;
using namespace std;
- typedef map<int,double> SparseDoubleVec;
+ typedef map<mcIdType,double> SparseDoubleVec;
/*!
* Internal class, not part of the public API.
public:
OverlapMapping(const ProcessorGroup& group, const OverlapElementLocator& locator);
- void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
- void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
- void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId);
- void prepare(const vector< int >& procsToSendField, int nbOfTrgElems);
- void computeDenoConservativeVolumic(int nbOfTuplesTrg);
+ void keepTracksOfSourceIds(int procId, DataArrayIdType *ids);
+ void keepTracksOfTargetIds(int procId, DataArrayIdType *ids);
+ void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId);
+ void prepare(const vector< int >& procsToSendField, mcIdType nbOfTrgElems);
+ void computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg);
// void computeDenoIntegralGlobConstraint();
// void computeDenoIntegral();
void computeDenoRevIntegral(const DataArrayDouble & targetAreas);
void multiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput, double default_val) const;
void transposeMultiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput);
private:
- void serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets,
+ void serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets,
int *countForRecv, int *offsetsForRecv) const;
- int serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0,
- int *&bigArrI, double *&bigArrD, int *count, int *offsets,
+ mcIdType serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0,
+ mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets,
int *countForRecv, int *offsForRecv) const;
- void unserializationST(int nbOfTrgElems, const int *nbOfElemsSrcPerProc, const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,
- const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs);
+ void unserializationST(mcIdType nbOfTrgElems, const mcIdType *nbOfElemsSrcPerProc, const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,
+ const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs);
void finishToFillFinalMatrixST();
void fillSourceIdsZipReceivedForMultiply();
* gives an old2new map for the local part of the source mesh that has been sent to proc#i, just based on the
* bounding box computation (this is potentially a larger set than what is finally in the interp matrix).
* Second member gives proc ID. */
- map < int, MCAuto<DataArrayInt> > _sent_src_ids;
+ map < int, MCAuto<DataArrayIdType> > _sent_src_ids;
//! See _sent_src_ids. Same for target mesh.
- map < int, MCAuto<DataArrayInt> > _sent_trg_ids;
+ map < int, MCAuto<DataArrayIdType> > _sent_trg_ids;
/**! Vector of matrixes (partial interpolation ratios), result of the LOCAL interpolator run.
* Indexing shared with _source_proc_id_st, and _target_proc_id_st. */
/**! Number of received source mesh IDs at mesh data exchange.
Counting the number of IDs suffices, as we just need this to prepare the receive side, when doing the final vector matrix multiplication.
First dimension is the remote proc ID from which we received. */
- map <int, int > _nb_of_rcv_src_ids;
+ map <int, mcIdType > _nb_of_rcv_src_ids;
/**! Specifies for each (target) remote proc ID (first dim of the map) the corresponding
* source cell IDs to use.
* This information is stored from the *locally* COMPuted matrices, and corresponds hence to field value that will need to
* sent later on, if this matrix bit itself is sent aways. */
- map<int, vector<int> > _src_ids_zip_comp;
+ map<int, vector<mcIdType> > _src_ids_zip_comp;
/**! Same idea as _src_ids_zip_comp above, but for RECEIVED matrix. */
- map<int, vector<int> > _src_ids_zip_recv;
+ map<int, vector<mcIdType> > _src_ids_zip_recv;
/**! THE matrix for matrix-vector product. The first dimension is indexed in the set of target procs
* that interacts with local source mesh. The second dim is the target cell ID.
*/
ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& proc_group):
_field(subdomain_field),
- _component_topology(ComponentTopology(_field->getNumberOfComponents())),_topology(0),_own_support(false),
+ _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(0),_own_support(false),
_support(sup)
{
if(_field)
* For example if _field is a nodal field : returned array will be the nodal global numbers.
* The content of this method is used to inform Working side to accumulate data received by lazy side.
*/
- DataArrayInt* ParaFIELD::returnCumulativeGlobalNumbering() const
+ DataArrayIdType* ParaFIELD::returnCumulativeGlobalNumbering() const
{
if(!_field)
return 0;
}
}
- DataArrayInt* ParaFIELD::returnGlobalNumbering() const
+ DataArrayIdType* ParaFIELD::returnGlobalNumbering() const
{
if(!_field)
return 0;
#include "MEDCouplingRefCountObject.hxx"
#include "ComponentTopology.hxx"
+#include "MCType.hxx"
namespace MEDCoupling
{
void synchronizeSource( MEDCoupling::ParaFIELD* target_field);
MEDCouplingFieldDouble* getField() const { return _field; }
void setOwnSupport(bool v) const { _own_support=v; }
- DataArrayInt* returnCumulativeGlobalNumbering() const;
- DataArrayInt* returnGlobalNumbering() const;
+ DataArrayIdType* returnCumulativeGlobalNumbering() const;
+ DataArrayIdType* returnGlobalNumbering() const;
Topology* getTopology() const { return _topology; }
ParaMESH* getSupport() const { return _support; }
int nbComponents() const;
--- /dev/null
+// Copyright (C) 2007-2019 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __ParaIdType_HXX__
+#define __ParaIdType_HXX__
+
+#include <mpi.h>
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+#define MPI_ID_TYPE MPI_INT
+#else
+#define MPI_ID_TYPE MPI_LONG
+#endif
+
+#endif
namespace MEDCoupling
{
ParaMESH::ParaMESH( MEDCouplingPointSet *subdomain_mesh, MEDCouplingPointSet *subdomain_face,
- DataArrayInt *CorrespElt_local2global, DataArrayInt *CorrespFace_local2global,
- DataArrayInt *CorrespNod_local2global, const ProcessorGroup& proc_group ):
+ DataArrayIdType *CorrespElt_local2global, DataArrayIdType *CorrespFace_local2global,
+ DataArrayIdType *CorrespNod_local2global, const ProcessorGroup& proc_group ):
_cell_mesh(subdomain_mesh),
_face_mesh(subdomain_face),
_my_domain_id(proc_group.myRank()),
{
if(_cell_mesh)
_cell_mesh->incrRef();
- int nb_elem=mesh->getNumberOfCells();
+ mcIdType nb_elem=mesh->getNumberOfCells();
_explicit_topology=new BlockTopology(proc_group,nb_elem);
- int nbOfCells=mesh->getNumberOfCells();
- _cell_global = DataArrayInt::New();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ _cell_global = DataArrayIdType::New();
_cell_global->alloc(nbOfCells,1);
- int *cellglobal=_cell_global->getPointer();
- int offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0));
- for (int i=0; i<nbOfCells; i++)
+ mcIdType *cellglobal=_cell_global->getPointer();
+ mcIdType offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0));
+ for (mcIdType i=0; i<nbOfCells; i++)
{
cellglobal[i]=offset+i;
}
}
- void ParaMESH::setNodeGlobal(DataArrayInt *nodeGlobal)
+ void ParaMESH::setNodeGlobal(DataArrayIdType *nodeGlobal)
{
if(nodeGlobal!=_node_global)
{
}
}
- void ParaMESH::setCellGlobal(DataArrayInt *cellGlobal)
+ void ParaMESH::setCellGlobal(DataArrayIdType *cellGlobal)
{
if(cellGlobal!=_cell_global)
{
const ProcessorGroup& proc_group, const std::string& name);
ParaMESH( MEDCouplingPointSet *subdomain_mesh,
MEDCouplingPointSet *subdomain_face,
- DataArrayInt *CorrespElt_local2global,
- DataArrayInt *CorrespFace_local2global,
- DataArrayInt *CorrespNod_local2global,
+ DataArrayIdType *CorrespElt_local2global,
+ DataArrayIdType *CorrespFace_local2global,
+ DataArrayIdType *CorrespNod_local2global,
const ProcessorGroup& proc_group ) ;
virtual ~ParaMESH();
- void setNodeGlobal(DataArrayInt *nodeGlobal);
- void setCellGlobal(DataArrayInt *cellGlobal);
+ void setNodeGlobal(DataArrayIdType *nodeGlobal);
+ void setCellGlobal(DataArrayIdType *cellGlobal);
Topology* getTopology() const { return _explicit_topology; }
bool isStructured() const { return _cell_mesh->isStructured(); }
MEDCouplingPointSet *getCellMesh() const { return _cell_mesh; }
MEDCouplingPointSet *getFaceMesh() const { return _face_mesh; }
BlockTopology* getBlockTopology() const { return _block_topology; }
- DataArrayInt* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; }
- DataArrayInt* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; }
- DataArrayInt* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; }
- const int* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; }
- const int* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; }
- const int* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; }
+ DataArrayIdType* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; }
+ DataArrayIdType* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; }
+ DataArrayIdType* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; }
+ const mcIdType* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; }
+ const mcIdType* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; }
+ const mcIdType* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; }
private:
//mesh object underlying the ParaMESH object
MEDCoupling::BlockTopology* _block_topology;
Topology* _explicit_topology;
// pointers to global numberings
- DataArrayInt* _node_global;
- DataArrayInt* _face_global;
- DataArrayInt* _cell_global;
+ DataArrayIdType* _node_global;
+ DataArrayIdType* _face_global;
+ DataArrayIdType* _cell_global;
};
}
virtual void intersect (ProcessorGroup&) = 0;
bool contains(int rank) const { return _proc_ids.find(rank)!=_proc_ids.end(); }
virtual bool containsMyRank() const = 0;
- int size() const { return _proc_ids.size(); }
+ int size() const { return (int)_proc_ids.size(); }
const CommInterface& getCommInterface()const { return _comm_interface; }
virtual int myRank() const = 0;
virtual int translateRank(const ProcessorGroup*, int) const = 0;
int myranksource = _topo_source->getProcGroup()->myRank();
- vector <int>* target_arrays=new vector<int>[_topo_target->getProcGroup()->size()];
+ vector <mcIdType>* target_arrays=new vector<mcIdType>[_topo_target->getProcGroup()->size()];
//cout<<" topotarget size"<< _topo_target->getProcGroup()->size()<<endl;
- int nb_local = _topo_source-> getNbLocalElements();
- for (int ielem=0; ielem< nb_local ; ielem++)
+ mcIdType nb_local = _topo_source-> getNbLocalElements();
+ for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
// cout <<"source local :"<<myranksource<<","<<ielem<<endl;
- int global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
+ mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
// cout << "global "<<global<<endl;
- pair<int,int> target_local =_topo_target->globalToLocal(global);
+ pair<int,mcIdType> target_local =_topo_target->globalToLocal(global);
// cout << "target local : "<<target_local.first<<","<<target_local.second<<endl;
target_arrays[target_local.first].push_back(target_local.second);
}
- int union_size=group->size();
+ std::size_t union_size=group->size();
_send_counts=new int[union_size];
_send_displs=new int[union_size];
_recv_counts=new int[union_size];
_recv_displs=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_send_counts[i]=0;
_recv_counts[i]=0;
{
//converts the rank in target to the rank in union communicator
int unionrank=group->translateRank(_topo_target->getProcGroup(),iproc);
- _send_counts[unionrank]=target_arrays[iproc].size();
+ _send_counts[unionrank]=(int)target_arrays[iproc].size();
}
for (int iproc=1; iproc<group->size();iproc++)
int* counter=new int [_topo_target->getProcGroup()->size()];
counter[0]=0;
for (int i=1; i<_topo_target->getProcGroup()->size(); i++)
- counter[i]=counter[i-1]+target_arrays[i-1].size();
+ counter[i]=counter[i-1]+(int)target_arrays[i-1].size();
const double* value = _local_field->getField()->getArray()->getPointer();
//cout << "Nb local " << nb_local<<endl;
for (int ielem=0; ielem<nb_local ; ielem++)
{
- int global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
- pair<int,int> target_local =_topo_target->globalToLocal(global);
+ mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem));
+ pair<int,mcIdType> target_local =_topo_target->globalToLocal(global);
//cout <<"global : "<< global<<" local :"<<target_local.first<<" "<<target_local.second;
//cout <<"counter[]"<<counter[target_local.first]<<endl;
_send_buffer[counter[target_local.first]++]=value[ielem];
int myranktarget = _topo_target->getProcGroup()->myRank();
- vector < vector <int> > source_arrays(_topo_source->getProcGroup()->size());
- int nb_local = _topo_target-> getNbLocalElements();
- for (int ielem=0; ielem< nb_local ; ielem++)
+ vector < vector <mcIdType> > source_arrays(_topo_source->getProcGroup()->size());
+ mcIdType nb_local = _topo_target-> getNbLocalElements();
+ for (mcIdType ielem=0; ielem< nb_local ; ielem++)
{
// cout <<"TS target local :"<<myranktarget<<","<<ielem<<endl;
- int global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
+ mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
//cout << "TS global "<<global<<endl;
- pair<int,int> source_local =_topo_source->globalToLocal(global);
+ pair<int,mcIdType> source_local =_topo_source->globalToLocal(global);
// cout << "TS source local : "<<source_local.first<<","<<source_local.second<<endl;
source_arrays[source_local.first].push_back(source_local.second);
}
- int union_size=group->size();
+ std::size_t union_size=group->size();
_recv_counts=new int[union_size];
_recv_displs=new int[union_size];
_send_counts=new int[union_size];
_send_displs=new int[union_size];
- for (int i=0; i< union_size; i++)
+ for (std::size_t i=0; i< union_size; i++)
{
_send_counts[i]=0;
_recv_counts[i]=0;
{
//converts the rank in target to the rank in union communicator
int unionrank=group->translateRank(_topo_source->getProcGroup(),iproc);
- _recv_counts[unionrank]=source_arrays[iproc].size();
+ _recv_counts[unionrank]=(int)source_arrays[iproc].size();
}
- for (int i=1; i<union_size; i++)
+ for (std::size_t i=1; i<union_size; i++)
_recv_displs[i]=_recv_displs[i-1]+_recv_counts[i-1];
_recv_buffer=new double[nb_local];
{
MPI_Status status;
- int* serializer=0;
- int size;
+ mcIdType* serializer=0;
+ mcIdType size;
MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface);
MESSAGE(" rank "<<group->myRank()<< "received master rank"<<rank_master);
}
// The topology is broadcasted to all processors in the group
- _comm_interface->broadcast(&size, 1,MPI_INT,rank_master,*(group->getComm()));
+ _comm_interface->broadcast(&size, 1,MPI_ID_TYPE,rank_master,*(group->getComm()));
- int* buffer=new int[size];
+ mcIdType* buffer=new mcIdType[size];
if (topo!=0 && topo->getProcGroup()->myRank()==0)
copy(serializer, serializer+size, buffer);
- _comm_interface->broadcast(buffer,size,MPI_INT,rank_master,*(group->getComm()));
+ _comm_interface->broadcast(buffer,(int)size,MPI_ID_TYPE,rank_master,*(group->getComm()));
// Processors which did not possess the source topology
// unserialize it
_recv_buffer, _recv_counts, _recv_displs, MPI_DOUBLE,comm);
cout<<"end AllToAll"<<endl;
- int nb_local = _topo_target->getNbLocalElements();
+ mcIdType nb_local = _topo_target->getNbLocalElements();
//double* value=new double[nb_local];
double* value=const_cast<double*>(_local_field->getField()->getArray()->getPointer());
delete group;
}
- for (int ielem=0; ielem<nb_local ; ielem++)
+ for (mcIdType ielem=0; ielem<nb_local ; ielem++)
{
- int global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
- pair<int,int> source_local =_topo_source->globalToLocal(global);
+ mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem));
+ pair<int,mcIdType> source_local =_topo_source->globalToLocal(global);
value[ielem]=_recv_buffer[counters[source_local.first]++];
}
#ifndef __TOPOLOGY_HXX__
#define __TOPOLOGY_HXX__
+#include "MCType.hxx"
+
namespace MEDCoupling
{
class ProcessorGroup;
public:
Topology() { }
virtual ~Topology() { }
- virtual int getNbElements() const = 0;
- virtual int getNbLocalElements() const = 0;
+ virtual mcIdType getNbElements() const = 0;
+ virtual mcIdType getNbLocalElements() const = 0;
virtual const ProcessorGroup* getProcGroup()const = 0;
};
}
const double sourceCoordsAll[2][8]={{0.4,0.5,0.4,1.5,1.6,1.5,1.6,0.5},
{0.3,-0.5,1.6,-0.5,1.6,-1.5,0.3,-1.5}};
- int conn4All[8]={0,1,2,3,4,5,6,7};
+ mcIdType conn4All[8]={0,1,2,3,4,5,6,7};
std::ostringstream stream; stream << "sourcemesh2D proc " << grank;
mesh=MEDCouplingUMesh::New(stream.str().c_str(),2);
const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4},
{0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7},
{0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}};
- int conn4All[8]={0,1,2,3,4,5,6,7};
+ mcIdType conn4All[8]={0,1,2,3,4,5,6,7};
double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}};
std::ostringstream stream; stream << "targetmesh2D proc " << grank-(gsize-lsize);
CommInterface interface;
MPIProcessorGroup group(interface);
BlockTopology blocktopo(group,1);
- CPPUNIT_ASSERT_EQUAL(1,blocktopo.getNbLocalElements());
- CPPUNIT_ASSERT_EQUAL(size,blocktopo.getNbElements());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),blocktopo.getNbLocalElements());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(size),blocktopo.getNbElements());
CPPUNIT_ASSERT_EQUAL(1,blocktopo.getDimension());
//checking access methods
global=blocktopo2.localToGlobal(local);
CPPUNIT_ASSERT_EQUAL(global,2*size-1);
- std::vector<std::pair<int,int> > bounds = blocktopo2.getLocalArrayMinMax();
+ std::vector<std::pair<int,mcIdType> > bounds = blocktopo2.getLocalArrayMinMax();
int vecsize = bounds.size();
CPPUNIT_ASSERT_EQUAL(1,vecsize);
CPPUNIT_ASSERT_EQUAL(2*rank, (bounds[0]).first);
- CPPUNIT_ASSERT_EQUAL(2*rank+2, (bounds[0]).second);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2*rank+2), (bounds[0]).second);
}
void ParaMEDMEMTest::testBlockTopology_serialize()
//testing the serialization process that is used to transfer a
//block topology via a MPI_Send/Recv comm
BlockTopology blocktopo_recv;
- int* serializer;
- int sersize;
+ mcIdType* serializer;
+ mcIdType sersize;
blocktopo.serialize(serializer,sersize);
blocktopo_recv.unserialize(serializer,interface);
CPPUNIT_ASSERT_EQUAL(blocktopo.getNbElements(),blocktopo_recv.getNbElements());
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->finishInsertingCells();
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[6]={0,2,1,2,3,1};
+ mcIdType targetConn[6]={0,2,1,2,3,1};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->finishInsertingCells();
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[6]={0,2,1,2,3,1};
+ mcIdType targetConn[6]={0,2,1,2,3,1};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[8]={0,1,3,2,4,5,7,6};
+ const mcIdType conn[8]={0,1,3,2,4,5,7,6};
m->allocateCells(2);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4);
const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
+ const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
m->allocateCells(2);
for(int i=0;i<4;i++)
m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i);
std::copy(cooData,cooData+189,arr->getPointer());
mesh->setCoords(arr);
mesh->allocateCells(80);
- const int conn[240]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29};
+ const mcIdType conn[240]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29};
for(int i=0;i<80;i++)
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i);
MCAuto<MEDCouplingFieldDouble> f(MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME));
std::copy(cooData,cooData+66,arr->getPointer());
mesh->setCoords(arr);
mesh->allocateCells(10);
- const int conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20};
+ const mcIdType conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20};
for(int i=0;i<10;i++)
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4*i);
MCAuto<MEDCouplingFieldDouble> f(MEDCouplingFieldDouble::New(type==0?ON_CELLS:ON_NODES,ONE_TIME));
{
double pmin=1e38, pmax=-1e38;
const double *p(vitesse->getField()->getArray()->begin());
- for(std::size_t i=0;i<vitesse->getField()->getArray()->getNbOfElems();i++,p++)
+ for(mcIdType i=0;i<vitesse->getField()->getArray()->getNbOfElems();i++,p++)
{
if (*p<pmin) pmin=*p;
if (*p>pmax) pmax=*p;
{
//
const double sourceCoords[19*3]={0.5,0.5,0.1,0.5,0.5,1.2,0.5,0.5,1.6,0.5,0.5,1.8,0.5,0.5,2.43,0.5,0.5,2.55,0.5,0.5,4.1,0.5,0.5,4.4,0.5,0.5,4.9,0.5,0.5,5.1,0.5,0.5,7.6,0.5,0.5,7.7,0.5,0.5,8.2,0.5,0.5,8.4,0.5,0.5,8.6,0.5,0.5,8.8,0.5,0.5,9.2,0.5,0.5,9.6,0.5,0.5,11.5};
- const int sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18};
+ const mcIdType sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18};
const double sourceVals[19]={0.49,2.8899999999999997,7.29,13.69,22.09,32.49,44.89,59.29,75.69,94.09, 114.49,136.89,161.29,187.69,216.09,246.49,278.89,313.29,349.69};
const double targetCoords0[20*3]={0.,0.,0.,1.,0.,0.,0.,1.,0.,1.,1.,0.,0.,0.,1.,1.,0.,1.,0.,1.,1.,1.,1.,1.,0.,0.,2.,1.,0.,2.,0.,1.,2.,1.,1.,2.,0.,0.,3.,1.,0.,3.,0.,1.,3.,1.,1.,3.,0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.};
- const int targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19};
+ const mcIdType targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19};
const double targetCoords1[28*3]={0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.,0.,0.,5.,1.,0.,5.,0.,1.,5.,1.,1.,5.,0.,0.,6.,1.,0.,6.,0.,1.,6.,1.,1.,6.,0.,0.,7.,1.,0.,7.,0.,1.,7.,1.,1.,7.,0.,0.,8.,1.,0.,8.,0.,1.,8.,1.,1.,8.,0.,0.,9.,1.,0.,9.,0.,1.,9.,1.,1.,9.,0.,0.,10.,1.,0.,10.,0.,1.,10.,1.,1.,10.};
- const int targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27};
+ const mcIdType targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27};
//
int size;
int rank;
const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[8]={0,1,3,2,4,5,7,6};
+ const mcIdType conn[8]={0,1,3,2,4,5,7,6};
m->allocateCells(2);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4);
const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.};
coo->alloc(8,3);
std::copy(dataCoo,dataCoo+24,coo->getPointer());
- const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
+ const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7};
m->allocateCells(4);
for(int i=0;i<4;i++)
m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i);
champ_recepteur->setOwnSupport(true);
}
-
MPI_Barrier(MPI_COMM_WORLD);
clock_t clock0(clock());
if(rank==0)
{
double coords[4]={0.3,0.7, 0.9,1.0};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",1);
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==1)
{
double coords[2]={0.7,0.9};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc1",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==2)
{
double coords[2]={1.,1.12};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc2",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==3)
{
double coords[2]={0.5,0.75};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc3",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==4)
{
double coords[2]={0.75,1.2};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc4",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==0)
{
double coords[8]={0.3,0.3,0.7,0.7, 0.9,0.9,1.0,1.0};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",1);
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==1)
{
double coords[4]={0.7,0.7,0.9,0.9};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc1",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==2)
{
double coords[4]={1.,1.,1.12,1.12};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Source mesh Proc2",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==3)
{
double coords[4]={0.5,0.5,0.75,0.75};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc3",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
if(rank==4)
{
double coords[4]={0.75,0.75,1.2,1.2};
- int conn[2]={0,1};
+ mcIdType conn[2]={0,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc4",1);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4},
{0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7},
{0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}};
- int conn4All[8]={0,1,2,3,4,5,6,7};
+ mcIdType conn4All[8]={0,1,2,3,4,5,6,7};
double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}};
double targetResults2[3][2]={{0.28333333333333344,0.56666666666666687},{1.8564102564102569,2.0128205128205132},{1.0846153846153845,0.36153846153846159}};
double targetResults3[3][2]={{3.7777777777777781,7.5555555555555562},{24.511111111111113,26.355555555555558},{14.1,4.7}};
if(rank==0)
{
double coords[6]={-0.3,-0.3, 0.7,0.7, 0.7,-0.3};
- int conn[3]={0,1,2};
+ mcIdType conn[3]={0,1,2};
//int globalNode[3]={1,2,0};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",2);
mesh->allocateCells(1);
if(rank==1)
{
double coords[6]={-0.3,-0.3, -0.3,0.7, 0.7,0.7};
- int conn[3]={0,1,2};
+ mcIdType conn[3]={0,1,2};
//int globalNode[3]={1,3,2};
mesh=MEDCouplingUMesh::New("Source mesh Proc1",2);
mesh->allocateCells(1);
if(rank==2)
{
double coords[10]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2 };
- int conn[7]={0,3,4,1, 1,4,2};
+ mcIdType conn[7]={0,3,4,1, 1,4,2};
//int globalNode[5]={4,3,0,2,1};
mesh=MEDCouplingUMesh::New("Target mesh Proc2",2);
mesh->allocateCells(2);
mesh->setCoords(myCoords);
myCoords->decrRef();
paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
- DataArrayInt *da=DataArrayInt::New();
- const int globalNumberingP2[5]={0,1,2,3,4};
+ DataArrayIdType *da=DataArrayIdType::New();
+ const mcIdType globalNumberingP2[5]={0,1,2,3,4};
da->useArray(globalNumberingP2,false,DeallocType::CPP_DEALLOC,5,1);
paramesh->setNodeGlobal(da);
da->decrRef();
if(rank==3)
{
double coords[6]={0.2,0.2, 0.7,-0.3, 0.7,0.2};
- int conn[3]={0,2,1};
+ mcIdType conn[3]={0,2,1};
//int globalNode[3]={1,0,5};
mesh=MEDCouplingUMesh::New("Target mesh Proc3",2);
mesh->allocateCells(1);
mesh->setCoords(myCoords);
myCoords->decrRef();
paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
- DataArrayInt *da=DataArrayInt::New();
- const int globalNumberingP3[3]={4,2,5};
+ DataArrayIdType *da=DataArrayIdType::New();
+ const mcIdType globalNumberingP3[3]={4,2,5};
da->useArray(globalNumberingP3,false,DeallocType::CPP_DEALLOC,3,1);
paramesh->setNodeGlobal(da);
da->decrRef();
if(rank==4)
{
double coords[12]={-0.3,0.2, -0.3,0.7, 0.2,0.7, 0.2,0.2, 0.7,0.7, 0.7,0.2};
- int conn[8]={0,1,2,3, 3,2,4,5};
+ mcIdType conn[8]={0,1,2,3, 3,2,4,5};
//int globalNode[6]={2,6,7,1,8,5};
mesh=MEDCouplingUMesh::New("Target mesh Proc4",2);
mesh->allocateCells(2);
mesh->setCoords(myCoords);
myCoords->decrRef();
paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
- DataArrayInt *da=DataArrayInt::New();
- const int globalNumberingP4[6]={3,6,7,4,8,5};
+ DataArrayIdType *da=DataArrayIdType::New();
+ const mcIdType globalNumberingP4[6]={3,6,7,4,8,5};
da->useArray(globalNumberingP4,false,DeallocType::CPP_DEALLOC,6,1);
paramesh->setNodeGlobal(da);
da->decrRef();
myCoords->decrRef();
if(rank==0)
{
- int targetConn[7]={0,3,4,1, 1,4,2};
+ mcIdType targetConn[7]={0,3,4,1, 1,4,2};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+4);
}
else
{
- int targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4};
mesh->allocateCells(3);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+3);
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
mesh->finishInsertingCells();
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
- int targetConn[6]={0,2,1,2,3,1};
+ mcIdType targetConn[6]={0,2,1,2,3,1};
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
if(source_group->containsMyRank())
{
double coords[15]={1.,0.,0., 2.,0.,0., 2.,2.,0., 0.,2.,0., 0.5,0.5,1.};
- int conn[7]={0,1,2,3,0,3,4};
+ mcIdType conn[7]={0,1,2,3,0,3,4};
mesh=MEDCouplingUMesh::New("Source mesh Proc0",2);
mesh->allocateCells(2);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
if(rank==1)
{
double coords[12]={0.25,0.25,0.5, 0.,0.25,0.5, 0.,0.,0.5, 0.25,0.,0.5};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Target mesh Proc1",2);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
if(rank==2)
{
double coords[12]={0.,0.25,0.5, 0.,0.,0.5, -1.,0.,0.5, -1.,0.25,0.5};
- int conn[4]={0,1,2,3};
+ mcIdType conn[4]={0,1,2,3};
mesh=MEDCouplingUMesh::New("Target mesh Proc2",2);
mesh->allocateCells(1);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
std::copy(coordsS,coordsS+10,myCoords->getPointer());
meshS->setCoords(myCoords);
myCoords->decrRef();
- int connS[7]={0,3,4,1, 1,4,2};
+ mcIdType connS[7]={0,3,4,1, 1,4,2};
meshS->allocateCells(2);
meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS);
meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS+4);
std::copy(coordsT,coordsT+6,myCoords->getPointer());
meshT->setCoords(myCoords);
myCoords->decrRef();
- int connT[3]={0,2,1};
+ mcIdType connT[3]={0,2,1};
meshT->allocateCells(1);
meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT->finishInsertingCells();
std::copy(coordsS,coordsS+10,myCoords->getPointer());
meshS->setCoords(myCoords);
myCoords->decrRef();
- int connS[7]={0,1,2, 1,3,4,2};
+ mcIdType connS[7]={0,1,2, 1,3,4,2};
meshS->allocateCells(2);
meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS);
meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS+3);
std::copy(coordsT,coordsT+6,myCoords->getPointer());
meshT->setCoords(myCoords);
myCoords->decrRef();
- int connT[3]={0,2,1};
+ mcIdType connT[3]={0,2,1};
meshT->allocateCells(1);
meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT->finishInsertingCells();
std::copy(coordsS,coordsS+8,myCoords->getPointer());
meshS->setCoords(myCoords);
myCoords->decrRef();
- int connS[4]={0,2,3,1};
+ mcIdType connS[4]={0,2,3,1};
meshS->allocateCells(1);
meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS);
meshS->finishInsertingCells();
std::copy(coordsT,coordsT+6,myCoords->getPointer());
meshT->setCoords(myCoords);
myCoords->decrRef();
- int connT[3]={0,1,2};
+ mcIdType connT[3]={0,1,2};
meshT->allocateCells(1);
meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT->finishInsertingCells();
myCoords->alloc(5,2);
std::copy(coords,coords+10,myCoords->getPointer());
meshS_0->setCoords(myCoords); myCoords->decrRef();
- int connS[4]={0,1,2,3};
+ mcIdType connS[4]={0,1,2,3};
meshS_0->allocateCells(2);
meshS_0->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS);
//
std::copy(coords,coords+10,myCoords->getPointer());
meshT_0->setCoords(myCoords);
myCoords->decrRef();
- int connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4};
+ mcIdType connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4};
meshT_0->allocateCells(4);
meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT);
meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT+3);
parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo);
int nb_local=mesh->getNumberOfCells();
- const int* global_numbering = paramesh->getGlobalNumberingCell();
+ const mcIdType* global_numbering = paramesh->getGlobalNumberingCell();
double *value=parafield->getField()->getArray()->getPointer();
for(int ielem=0; ielem<nb_local;ielem++)
mpi_access.status( RecvRequestId[i] , source , tag , error ,
outcount ) ;
if ( i != 0 ) {
- if ( outcount != 1000*i |
- (recvbuf[i][outcount-1] != (outcount-1)) ) {
+ if (( outcount != 1000*i ) ||
+ ((recvbuf[i][outcount-1] != (outcount-1)))) {
ostringstream strstream ;
strstream << "========================================================"
<< endl << "test" << myrank << " outcount " << outcount
ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_DIRS}
def MEDCouplingDataArrayIntIpow(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DataArrayInt____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt32Iadd(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayFloatIadd(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DataArrayFloat____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
+ import _ParaMEDMEM
+ return _ParaMEDMEM.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _ParaMEDMEM.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
import _ParaMEDMEM
- return _ParaMEDMEM.DataArrayIntTuple____imod___(self, self, *args)
+ return _ParaMEDMEM.DataArrayInt64Tuple____imod___(self, self, *args)
def MEDCouplingDenseMatrixIadd(self,*args):
import _ParaMEDMEM
return _ParaMEDMEM.DenseMatrix____iadd___(self, self, *args)
{
PyObject *getGlobalNumberingCell2() const
{
- const int *tmp=self->getGlobalNumberingCell();
- int size=self->getCellMesh()->getNumberOfCells();
+ const mcIdType *tmp=self->getGlobalNumberingCell();
+ mcIdType size=self->getCellMesh()->getNumberOfCells();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(mcIdType i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(tmp[i]));
return ret;
}
PyObject *getGlobalNumberingFace2() const
{
- const int *tmp=self->getGlobalNumberingFace();
- int size=self->getFaceMesh()->getNumberOfCells();
+ const mcIdType *tmp=self->getGlobalNumberingFace();
+ mcIdType size=self->getFaceMesh()->getNumberOfCells();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(mcIdType i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(tmp[i]));
return ret;
}
PyObject *getGlobalNumberingNode2() const
{
- const int *tmp=self->getGlobalNumberingNode();
- int size=self->getCellMesh()->getNumberOfNodes();
+ const mcIdType *tmp=self->getGlobalNumberingNode();
+ mcIdType size=self->getCellMesh()->getNumberOfNodes();
PyObject *ret=PyList_New(size);
- for(int i=0;i<size;i++)
+ for(mcIdType i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(tmp[i]));
return ret;
}
ADD_DEFINITIONS("-DENABLE_BOOST")
ENDIF(Boost_FOUND)
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
# Include directories
INCLUDE_DIRECTORIES(
${MEDFILE_INCLUDE_DIRS}
int main(int argc, char** argv)
{
double t_begin,t_read_st,t_compute_graph,t_family,t_field;
- t_begin=clock();
+ t_begin=(double)clock();
if (argc <5)
{
cerr << "Usage : " << argv[0]
std::ostringstream oss; oss << "In file \"" << filename_in << "\" the mesh name \"" << meshname<< "\" exists but is not unstructured !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- t_read_st=clock();
+ t_read_st=(double)clock();
cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Reading mesh
MCAuto<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
ipermSafe=iperm; permSafe=perm;
delete renumb;
ipermSafe=0;//erase new2old, we are using only old 2 new
- t_compute_graph=clock();
+ t_compute_graph=(double)clock();
cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl;
cout.flush();
// Connectivity
mc->setFamilyFieldArr(0,famField2);
}
mc->write(filename_out,2);
- t_family=clock();
+ t_family=(double)clock();
cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Fields
cout << "Reordering fields and writing : " << flush;
fs->write(filename_out,0);
//fs->renumberEntitiesLyingOnMesh(meshname,code,code,o2n); bugged
}
- t_field=clock();
+ t_field=(double)clock();
cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
return 0;
}
ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES CPLUSPLUS ON)
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_FLAGS "-py3")
def MEDCouplingDataArrayDoubleIpow(self,*args):
import _MEDRenumber
return _MEDRenumber.DataArrayDouble____ipow___(self, self, *args)
-def MEDCouplingDataArrayIntIadd(self,*args):
+def MEDCouplingDataArrayInt32Iadd(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntIsub(self,*args):
+ return _MEDRenumber.DataArrayInt32____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32Isub(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____isub___(self, self, *args)
-def MEDCouplingDataArrayIntImul(self,*args):
+ return _MEDRenumber.DataArrayInt32____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32Imul(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____imul___(self, self, *args)
-def MEDCouplingDataArrayIntIdiv(self,*args):
+ return _MEDRenumber.DataArrayInt32____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32Idiv(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntImod(self,*args):
+ return _MEDRenumber.DataArrayInt32____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32Imod(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____imod___(self, self, *args)
-def MEDCouplingDataArrayIntIpow(self,*args):
+ return _MEDRenumber.DataArrayInt32____imod___(self, self, *args)
+def MEDCouplingDataArrayInt32Ipow(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayInt____ipow___(self, self, *args)
+ return _MEDRenumber.DataArrayInt32____ipow___(self, self, *args)
+def MEDCouplingDataArrayInt64Iadd(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64Isub(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64Imul(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64Idiv(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64Imod(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64Ipow(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64____ipow___(self, self, *args)
def MEDCouplingDataArrayFloatIadd(self,*args):
import _MEDRenumber
return _MEDRenumber.DataArrayFloat____iadd___(self, self, *args)
def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
import _MEDRenumber
return _MEDRenumber.DataArrayDoubleTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIadd(self,*args):
+def MEDCouplingDataArrayInt32TupleIadd(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt32Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIsub(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____iadd___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIsub(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImul(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____isub___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImul(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____imul___(self, self, *args)
-def MEDCouplingDataArrayIntTupleIdiv(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt32TupleImod(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____idiv___(self, self, *args)
-def MEDCouplingDataArrayIntTupleImod(self,*args):
+ return _MEDRenumber.DataArrayInt32Tuple____imod___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIadd(self,*args):
import _MEDRenumber
- return _MEDRenumber.DataArrayIntTuple____imod___(self, self, *args)
+ return _MEDRenumber.DataArrayInt64Tuple____iadd___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIsub(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____isub___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImul(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____imul___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____idiv___(self, self, *args)
+def MEDCouplingDataArrayInt64TupleImod(self,*args):
+ import _MEDRenumber
+ return _MEDRenumber.DataArrayInt64Tuple____imod___(self, self, *args)
%}
DataArrayDouble.__idiv__=MEDCouplingDataArrayDoubleIdiv
DataArrayDouble.__ipow__=MEDCouplingDataArrayDoubleIpow
-DataArrayInt.__reduce__=MEDCouplingDataArrayIntReduce
-DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd
-DataArrayInt.__isub__=MEDCouplingDataArrayIntIsub
-DataArrayInt.__imul__=MEDCouplingDataArrayIntImul
-DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv
-DataArrayInt.__imod__=MEDCouplingDataArrayIntImod
-DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow
+DataArrayInt32.__reduce__=MEDCouplingDataArrayInt32Reduce
+DataArrayInt32.__iadd__=MEDCouplingDataArrayInt32Iadd
+DataArrayInt32.__isub__=MEDCouplingDataArrayInt32Isub
+DataArrayInt32.__imul__=MEDCouplingDataArrayInt32Imul
+DataArrayInt32.__idiv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__imod__=MEDCouplingDataArrayInt32Imod
+DataArrayInt32.__ipow__=MEDCouplingDataArrayInt32Ipow
+DataArrayInt64.__reduce__=MEDCouplingDataArrayInt64Reduce
+DataArrayInt64.__iadd__=MEDCouplingDataArrayInt64Iadd
+DataArrayInt64.__isub__=MEDCouplingDataArrayInt64Isub
+DataArrayInt64.__imul__=MEDCouplingDataArrayInt64Imul
+DataArrayInt64.__idiv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__imod__=MEDCouplingDataArrayInt64Imod
+DataArrayInt64.__ipow__=MEDCouplingDataArrayInt64Ipow
DataArrayDoubleTuple.__iadd__=MEDCouplingDataArrayDoubleTupleIadd
DataArrayDoubleTuple.__isub__=MEDCouplingDataArrayDoubleTupleIsub
DataArrayDoubleTuple.__imul__=MEDCouplingDataArrayDoubleTupleImul
DataArrayDoubleTuple.__idiv__=MEDCouplingDataArrayDoubleTupleIdiv
-DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd
-DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub
-DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul
-DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv
-DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod
+DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayInt32TupleIadd
+DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayInt32TupleIsub
+DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayInt32TupleImul
+DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayInt32TupleImod
+
+DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayInt64TupleIadd
+DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayInt64TupleIsub
+DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayInt64TupleImul
+DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayInt64TupleImod
+
+
+
del INTERPKERNELExceptionReduce
-del MEDCouplingDataArrayDoubleReduce
-del MEDCouplingDataArrayIntReduce
del MEDCouplingDataArrayDoubleIadd
-del MEDCouplingDataArrayDoubleIsub
-del MEDCouplingDataArrayDoubleImul
del MEDCouplingDataArrayDoubleIdiv
-del MEDCouplingDataArrayIntIadd
-del MEDCouplingDataArrayIntIsub
-del MEDCouplingDataArrayIntImul
-del MEDCouplingDataArrayIntIdiv
-del MEDCouplingDataArrayIntImod
+del MEDCouplingDataArrayDoubleImul
+del MEDCouplingDataArrayDoubleIpow
+del MEDCouplingDataArrayDoubleIsub
+del MEDCouplingDataArrayDoubleReduce
del MEDCouplingDataArrayDoubleTupleIadd
-del MEDCouplingDataArrayDoubleTupleIsub
-del MEDCouplingDataArrayDoubleTupleImul
del MEDCouplingDataArrayDoubleTupleIdiv
-del MEDCouplingDataArrayIntTupleIadd
-del MEDCouplingDataArrayIntTupleIsub
-del MEDCouplingDataArrayIntTupleImul
-del MEDCouplingDataArrayIntTupleIdiv
-del MEDCouplingDataArrayIntTupleImod
+del MEDCouplingDataArrayDoubleTupleImul
+del MEDCouplingDataArrayDoubleTupleIsub
+del MEDCouplingDataArrayInt32Iadd
+del MEDCouplingDataArrayInt32Idiv
+del MEDCouplingDataArrayInt32Imod
+del MEDCouplingDataArrayInt32Imul
+del MEDCouplingDataArrayInt32Ipow
+del MEDCouplingDataArrayInt32Isub
+del MEDCouplingDataArrayInt32Reduce
+del MEDCouplingDataArrayInt32TupleIadd
+del MEDCouplingDataArrayInt32TupleIdiv
+del MEDCouplingDataArrayInt32TupleImod
+del MEDCouplingDataArrayInt32TupleImul
+del MEDCouplingDataArrayInt32TupleIsub
+del MEDCouplingDataArrayInt64Iadd
+del MEDCouplingDataArrayInt64Idiv
+del MEDCouplingDataArrayInt64Imod
+del MEDCouplingDataArrayInt64Imul
+del MEDCouplingDataArrayInt64Ipow
+del MEDCouplingDataArrayInt64Isub
+del MEDCouplingDataArrayInt64Reduce
+del MEDCouplingDataArrayInt64TupleIadd
+del MEDCouplingDataArrayInt64TupleIdiv
+del MEDCouplingDataArrayInt64TupleImod
+del MEDCouplingDataArrayInt64TupleImul
+del MEDCouplingDataArrayInt64TupleIsub
+
%}