X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FElementLocator.cxx;h=31d7033cdb775fa1fd41b43ddff6d039247e34f8;hb=HEAD;hp=ba9ff36277a866fa4c9722729ca3dbdb59e8c42f;hpb=169c6a89a70a5866050d9f87a58714d27d407c8a;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index ba9ff3627..31d7033cd 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2024 CEA, EDF // // 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. +// 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 @@ -27,7 +27,7 @@ #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "DirectedBoundingBox.hxx" #include @@ -38,7 +38,7 @@ using namespace std; //#define USE_DIRECTED_BB -namespace ParaMEDMEM +namespace MEDCoupling { ElementLocator::ElementLocator(const ParaFIELD& sourceField, const ProcessorGroup& distant_group, @@ -71,24 +71,24 @@ namespace ParaMEDMEM return _local_para_field.getField()->getNature(); } - // ========================================================================== - // Procedure for exchanging mesh between a distant proc and a local processor - // param idistantrank proc id on distant group - // param distant_mesh on return , points to a local reconstruction of - // the distant mesh - // param distant_ids on return, contains a vector defining a correspondence - // between the distant ids and the ids of the local reconstruction - // ========================================================================== + + /*! Procedure for exchanging a mesh between a distant proc and a local processor + \param idistantrank proc id on distant group + \param distant_mesh on return , points to a local reconstruction of + the distant mesh + \param distant_ids on return, contains a vector defining a correspondence + between the distant ids and the ids of the local reconstruction + */ 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; - MEDCouplingAutoRefCountObjectPtr elems; + MCAuto elems; #ifdef USE_DIRECTED_BB INTERP_KERNEL::DirectedBoundingBox dbb; double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim); @@ -99,7 +99,7 @@ namespace ParaMEDMEM 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(); @@ -127,10 +127,10 @@ namespace ParaMEDMEM } - // ====================== - // Compute bounding boxes - // ====================== + /*! + Compute bounding boxes + */ void ElementLocator::_computeBoundingBoxes() { CommInterface comm_interface =_union_group->getCommInterface(); @@ -194,9 +194,10 @@ namespace ParaMEDMEM } - // ============================================= - // Intersect Bounding Box (with a given "irank") - // ============================================= + + /*! + * Intersect local bounding box with a given distant bounding box on "irank" + */ bool ElementLocator::_intersectsBoundingBox(int irank) { #ifdef USE_DIRECTED_BB @@ -208,9 +209,9 @@ namespace ParaMEDMEM double* local_bb = _domain_bounding_boxes+_union_group->myRank()*2*_local_cell_mesh_space_dim; double* distant_bb = _domain_bounding_boxes+irank*2*_local_cell_mesh_space_dim; + const double eps = 1e-12; for (int idim=0; idim < _local_cell_mesh_space_dim; idim++) { - const double eps = 1e-12; bool intersects = (distant_bb[idim*2]getCommInterface(); // First stage : exchanging sizes // ------------------------------ vector tinyInfoLocalD,tinyInfoDistantD(1);//not used for the moment - vector tinyInfoLocal,tinyInfoDistant; + vector tinyInfoLocal,tinyInfoDistant; vector tinyInfoLocalS; //Getting tiny info of local mesh to allow the distant proc to initialize and allocate //the transmitted mesh. @@ -250,12 +252,12 @@ namespace ParaMEDMEM 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); @@ -263,10 +265,10 @@ namespace ParaMEDMEM MEDCouplingPointSet *distant_mesh_tmp=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]); std::vector 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(); @@ -277,9 +279,9 @@ namespace ParaMEDMEM 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; @@ -296,9 +298,9 @@ namespace ParaMEDMEM 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); // @@ -306,10 +308,10 @@ namespace ParaMEDMEM //finish unserialization distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); // - distant_ids_recv=new int[tinyInfoDistant.back()]; - comm_interface.sendRecv(const_cast(reinterpret_cast(distant_ids_send->getConstPointer())),tinyInfoLocal.back(), MPI_INT, + distant_ids_recv=new mcIdType[tinyInfoDistant.back()]; + comm_interface.sendRecv(const_cast(reinterpret_cast(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) @@ -342,17 +344,17 @@ namespace ParaMEDMEM /*! * connected with ElementLocator::recvFromWorkingSideL */ - void ElementLocator::sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds) + void ElementLocator::sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds) { int procId=0; CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& eltIds=distantLocEltIds[procId]; + const vector& eltIds=distantLocEltIds[procId]; const vector& 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(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1115,*_comm); + comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1115,*_comm); comm.send(const_cast(reinterpret_cast(&valued[0])),lgth,MPI_DOUBLE,*iter,1116,*_comm); } } @@ -368,30 +370,30 @@ namespace ParaMEDMEM for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { std::vector& 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 >& distantLocEltIds) + void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds) { int procId=0; CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& eltIds=distantLocEltIds[procId]; - int lgth=eltIds.size(); + const vector& eltIds=distantLocEltIds[procId]; + int lgth=(int)eltIds.size(); comm.send(&lgth,1,MPI_INT,*iter,1121,*_comm); - comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1122,*_comm); + comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1122,*_comm); } } /*! * connected with ElementLocator::sendGlobalIdsToWorkingSideL */ - void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds) + void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds) { int procId=0; CommInterface comm; @@ -399,17 +401,17 @@ namespace ParaMEDMEM globalIds.resize(_distant_proc_ids.size()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& vec=distantLocEltIds[procId]; - std::vector& global=globalIds[procId]; + const std::vector& vec=distantLocEltIds[procId]; + std::vector& 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 >& globalIds) + void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds) { int procId=0; CommInterface comm; @@ -417,26 +419,26 @@ namespace ParaMEDMEM globalIds.resize(_distant_proc_ids.size()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - std::vector& global=globalIds[procId]; + std::vector& 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& distantGlobIds, const std::vector& sum) + void ElementLocator::sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum) { int procId=0; CommInterface comm; - int lgth=distantGlobIds.size(); + int lgth=(int)distantGlobIds.size(); for(vector::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(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1125,*_comm); + comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1125,*_comm); comm.send(const_cast(reinterpret_cast(&sum[0])),lgth,MPI_DOUBLE,*iter,1126,*_comm); } } @@ -444,35 +446,35 @@ namespace ParaMEDMEM /*! * connected with ElementLocator::recvCandidatesForAddElementsL */ - void ElementLocator::sendCandidatesForAddElementsW(const std::vector& distantGlobIds) + void ElementLocator::sendCandidatesForAddElementsW(const std::vector& distantGlobIds) { int procId=0; CommInterface comm; - int lgth=distantGlobIds.size(); + int lgth=(int)distantGlobIds.size(); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { comm.send(const_cast(reinterpret_cast(&lgth)),1,MPI_INT,*iter,1128,*_comm); - comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1129,*_comm); + comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1129,*_comm); } } /*! * connected with ElementLocator::sendAddElementsToWorkingSideL */ - void ElementLocator::recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd) + void ElementLocator::recvAddElementsFromLazyProcsW(std::vector >& 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::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int locLgth; - std::vector& eltToFeed=elementsToAdd[procId]; + std::vector& 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); } } @@ -483,7 +485,7 @@ namespace ParaMEDMEM { CommInterface comm; int toSend; - DataArrayInt *isCumulative=_local_para_field.returnCumulativeGlobalNumbering(); + DataArrayIdType *isCumulative=_local_para_field.returnCumulativeGlobalNumbering(); if(isCumulative) { toSend=CUMULATIVE_POLICY; @@ -510,12 +512,12 @@ namespace ParaMEDMEM { int lgth; comm.recv(&lgth,1,MPI_INT,*iter,1114,*_comm,&status); - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; ids.resize(lgth); vector 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::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector valsToSend(ids.size()); vector::iterator iter3=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++) + for(vector::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(); @@ -552,10 +554,10 @@ namespace ParaMEDMEM for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int lgth; - vector& ids=_ids_per_working_proc[procId]; + vector& 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); } } @@ -566,16 +568,16 @@ namespace ParaMEDMEM { 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::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& ids=_ids_per_working_proc[procId]; - vector valsToSend(ids.size()); - vector::iterator iter1=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) + const vector& ids=_ids_per_working_proc[procId]; + vector valsToSend(ids.size()); + vector::iterator iter1=valsToSend.begin(); + for(vector::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(); @@ -586,24 +588,24 @@ namespace ParaMEDMEM */ 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 sums; + std::map sums; for(vector::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& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector& 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::const_iterator iter1=ids.begin(); + vector::const_iterator iter1=ids.begin(); vector::const_iterator iter2=vals.begin(); for(;iter1!=ids.end();iter1++,iter2++) sums[*iter1]+=*iter2; @@ -611,9 +613,9 @@ namespace ParaMEDMEM //assign sum to prepare sending to working side for(procId=0;procId& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector& vals=_values_per_working_proc[procId]; - vector::const_iterator iter1=ids.begin(); + vector::const_iterator iter1=ids.begin(); vector::iterator iter2=vals.begin(); for(;iter1!=ids.end();iter1++,iter2++) *iter2=sums[*iter1]; @@ -631,38 +633,38 @@ namespace ParaMEDMEM */ 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 sums; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); - int nbElts=globalIds->getNumberOfTuples(); - std::set globalIdsS(globalIdsC,globalIdsC+nbElts); + DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); + const mcIdType *globalIdsC=globalIds->getConstPointer(); + mcIdType nbElts=globalIds->getNumberOfTuples(); + std::set globalIdsS(globalIdsC,globalIdsC+nbElts); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& ids0=_ids_per_working_proc[procId]; - int lgth0=ids0.size(); - std::set elts0; - for(int i=0;i& ids0=_ids_per_working_proc[procId]; + std::size_t lgth0=ids0.size(); + std::set elts0; + for(std::size_t i=0;i ids(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1129,*_comm,&status); - set ids1(ids.begin(),ids.end()); + vector ids(lgth); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1129,*_comm,&status); + set ids1(ids.begin(),ids.end()); ids.clear(); set 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& ids2=_ids_per_working_proc3[procId]; + std::vector& ids2=_ids_per_working_proc3[procId]; ids2.resize(tmp6.size()); std::copy(tmp6.begin(),tmp6.end(),ids2.begin()); //global->local - for(std::vector::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++) - *iter2=std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC; + for(std::vector::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++) + *iter2=ToIdType(std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC); } if(globalIds) globalIds->decrRef(); @@ -677,10 +679,10 @@ namespace ParaMEDMEM CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& vals=_ids_per_working_proc3[procId]; - int size=vals.size(); + const std::vector& vals=_ids_per_working_proc3[procId]; + int size=(int)vals.size(); comm.send(const_cast(reinterpret_cast(&size)),1,MPI_INT,*iter,1130,*_comm); - comm.send(const_cast(reinterpret_cast(&vals[0])),size,MPI_INT,*iter,1131,*_comm); + comm.send(const_cast(reinterpret_cast(&vals[0])),size,MPI_ID_TYPE,*iter,1131,*_comm); } } @@ -692,25 +694,25 @@ namespace ParaMEDMEM { int procId=0; CommInterface comm; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr 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 candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); + for(mcIdType *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++) (*iter1)=globalIdsC[*iter1]; - std::set candidatesS(candidates->begin(),candidates->end()); + std::set candidatesS(candidates->begin(),candidates->end()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& ids=_ids_per_working_proc[procId]; - vector valsToSend(ids.size()); - vector::iterator iter1=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) + const vector& ids=_ids_per_working_proc[procId]; + vector valsToSend(ids.size()); + vector::iterator iter1=valsToSend.begin(); + for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) *iter1=globalIdsC[*iter2]; - std::set tmp2(valsToSend.begin(),valsToSend.end()); - std::vector tmp3; - set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector >(tmp3)); - int lgth=tmp3.size(); + std::set tmp2(valsToSend.begin(),valsToSend.end()); + std::vector tmp3; + set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector >(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();