Back to index

salome-med  6.5.0
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
ParaMEDMEM::ElementLocator Class Reference

#include <ElementLocator.hxx>

Collaboration diagram for ParaMEDMEM::ElementLocator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ElementLocator (const ParaFIELD &sourceField, const ProcessorGroup &distant_group, const ProcessorGroup &local_group)
virtual ~ElementLocator ()
void exchangeMesh (int idistantrank, MEDCouplingPointSet *&target_mesh, int *&distant_ids)
void exchangeMethod (const std::string &sourceMeth, int idistantrank, std::string &targetMeth)
const std::vector< int > & getDistantProcIds () const
const MPI_Comm * getCommunicator () const
NatureOfField getLocalNature () const
bool isM1DCorr () const
 This method is used to informed if there is -1D mesh on distant_group side or on local_group side.
void recvPolicyFromLazySideW (std::vector< int > &policy)
 connected with ElementLocator::sendPolicyToWorkingSideL
void sendSumToLazySideW (const std::vector< std::vector< int > > &distantLocEltIds, const std::vector< std::vector< double > > &partialSumRelToDistantIds)
 connected with ElementLocator::recvFromWorkingSideL
void recvSumFromLazySideW (std::vector< std::vector< double > > &globalSumRelToDistantIds)
 connected with ElementLocator::sendToWorkingSideL
void sendCandidatesForAddElementsW (const std::vector< int > &distantGlobIds)
 connected with ElementLocator::recvCandidatesForAddElementsL
void recvAddElementsFromLazyProcsW (std::vector< std::vector< int > > &elementsToAdd)
 connected with ElementLocator::sendAddElementsToWorkingSideL
void sendLocalIdsToLazyProcsW (const std::vector< std::vector< int > > &distantLocEltIds)
 connected with ElementLocator::recvLocalIdsFromWorkingSideL
void recvGlobalIdsFromLazyProcsW (const std::vector< std::vector< int > > &distantLocEltIds, std::vector< std::vector< int > > &globalIds)
 connected with ElementLocator::sendGlobalIdsToWorkingSideL
void recvCandidatesGlobalIdsFromLazyProcsW (std::vector< std::vector< int > > &globalIds)
 connected with ElementLocator::sendCandidatesGlobalIdsToWorkingSideL
void sendPartialSumToLazyProcsW (const std::vector< int > &distantGlobIds, const std::vector< double > &sum)
 connected with ElementLocator::recvSumFromWorkingSideL
int sendPolicyToWorkingSideL ()
 connected with ElementLocator::recvPolicyFromLazySideW
void recvFromWorkingSideL ()
 connected with ElementLocator::sendSumToLazySideW
void sendToWorkingSideL ()
 connected with ElementLocator::recvSumFromLazySideW
void recvLocalIdsFromWorkingSideL ()
 connected with ElementLocator::sendLocalIdsToLazyProcsW
void sendGlobalIdsToWorkingSideL ()
 connected with ElementLocator::recvGlobalIdsFromLazyProcsW
void sendCandidatesGlobalIdsToWorkingSideL ()
 This method sends to working side Wi only nodes in interaction with Wi and located on boundary, to reduce number.
void recvSumFromWorkingSideL ()
 connected with ElementLocator::sendPartialSumToLazyProcsW
void recvCandidatesForAddElementsL ()
 Foreach working procs Wi compute and push it in _ids_per_working_proc3, if it exist, local id of nodes that are in interaction with an another lazy proc than this and that exists in this but with no interaction with this.
void sendAddElementsToWorkingSideL ()
 connected with ElementLocator::recvAddElementsFromLazyProcsW

Static Public Attributes

static const int CUMULATIVE_POLICY = 3
static const int NO_POST_TREATMENT_POLICY = 7

Private Member Functions

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)

Private Attributes

const ParaFIELD_local_para_field
MEDCouplingPointSet_local_cell_mesh
int _local_cell_mesh_space_dim
bool _is_m1d_corr
MEDCouplingPointSet_local_face_mesh
std::vector
< MEDCouplingPointSet * > 
_distant_cell_meshes
std::vector
< MEDCouplingPointSet * > 
_distant_face_meshes
double * _domain_bounding_boxes
const ProcessorGroup_distant_group
const ProcessorGroup_local_group
ProcessorGroup_union_group
std::vector< int > _distant_proc_ids
const MPI_Comm * _comm
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
< double > > 
_values_per_working_proc

Detailed Description

Definition at line 39 of file ElementLocator.hxx.


Constructor & Destructor Documentation

ParaMEDMEM::ElementLocator::ElementLocator ( const ParaFIELD sourceField,
const ProcessorGroup distant_group,
const ProcessorGroup local_group 
)

Definition at line 42 of file ElementLocator.cxx.

    : _local_para_field(sourceField),
      _local_cell_mesh(sourceField.getSupport()->getCellMesh()),
      _local_face_mesh(sourceField.getSupport()->getFaceMesh()),
      _distant_group(distant_group),
      _local_group(local_group)
  { 
    _union_group = _local_group.fuse(distant_group);
    _computeBoundingBoxes();
    _comm=getCommunicator();
  }

Here is the call graph for this function:

Definition at line 56 of file ElementLocator.cxx.

  {
    delete _union_group;
    delete [] _domain_bounding_boxes;
  }

Member Function Documentation

Definition at line 133 of file ElementLocator.cxx.

  {
    CommInterface comm_interface =_union_group->getCommInterface();
    MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
    const MPI_Comm* comm = group->getComm();
    _local_cell_mesh_space_dim = -1;
    if(_local_cell_mesh->getMeshDimension() != -1)
      _local_cell_mesh_space_dim=_local_cell_mesh->getSpaceDimension();
    int *spaceDimForAll=new int[_union_group->size()];
    comm_interface.allGather(&_local_cell_mesh_space_dim, 1, MPI_INT,
                             spaceDimForAll,1, MPI_INT, 
                             *comm);
    _local_cell_mesh_space_dim=*std::max_element(spaceDimForAll,spaceDimForAll+_union_group->size());
    _is_m1d_corr=((*std::min_element(spaceDimForAll,spaceDimForAll+_union_group->size()))==-1);
    for(int i=0;i<_union_group->size();i++)
      if(spaceDimForAll[i]!=_local_cell_mesh_space_dim && spaceDimForAll[i]!=-1)
        throw INTERP_KERNEL::Exception("Spacedim not matches !");
    delete [] spaceDimForAll;
#ifdef USE_DIRECTED_BB
    INTERP_KERNEL::DirectedBoundingBox dbb;
    int bbSize = dbb.dataSize(_local_cell_mesh_space_dim);
    _domain_bounding_boxes = new double[bbSize*_union_group->size()];
    if(_local_cell_mesh->getMeshDimension() != -1)
      dbb = INTERP_KERNEL::DirectedBoundingBox(_local_cell_mesh->getCoords()->getPointer(),
                                               _local_cell_mesh->getNumberOfNodes(),
                                               _local_cell_mesh_space_dim);
    std::vector<double> dbbData = dbb.getData();
    if ( dbbData.size() < bbSize ) dbbData.resize(bbSize,0);
    double * minmax= &dbbData[0];
#else
    int bbSize = 2*_local_cell_mesh_space_dim;
    _domain_bounding_boxes = new double[bbSize*_union_group->size()];
    double * minmax=new double [bbSize];
    if(_local_cell_mesh->getMeshDimension() != -1)
      _local_cell_mesh->getBoundingBox(minmax);
    else
      for(int i=0;i<_local_cell_mesh_space_dim;i++)
        {
          minmax[i*2]=-std::numeric_limits<double>::max();
          minmax[i*2+1]=std::numeric_limits<double>::max();
        }
#endif

    comm_interface.allGather(minmax, bbSize, MPI_DOUBLE,
                             _domain_bounding_boxes,bbSize, MPI_DOUBLE, 
                             *comm);
  
    for (int i=0; i< _distant_group.size(); i++)
      {
        int rank=_union_group->translateRank(&_distant_group,i);

        if (_intersectsBoundingBox(rank))
          {
            _distant_proc_ids.push_back(rank);
          }
      }
#ifdef USE_DIRECTED_BB
#else
    delete [] minmax;
#endif
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::_exchangeMesh ( MEDCouplingPointSet local_mesh,
MEDCouplingPointSet *&  distant_mesh,
int  iproc_distant,
const DataArrayInt distant_ids_send,
int *&  distant_ids_recv 
) [private]

Definition at line 224 of file ElementLocator.cxx.

  {
    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<string> tinyInfoLocalS;
    //Getting tiny info of local mesh to allow the distant proc to initialize and allocate
    //the transmitted mesh.
    local_mesh->getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
    tinyInfoLocal.push_back(distant_ids_send->getNumberOfTuples());
    tinyInfoDistant.resize(tinyInfoLocal.size());
    std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0);
    MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
    const MPI_Comm* comm=group->getComm();
    MPI_Status status; 
    
    // iproc_distant is the number of proc in distant group
    // it must be converted to union numbering before communication
    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, &status);
    DataArrayInt *v1Local=0;
    DataArrayDouble *v2Local=0;
    DataArrayInt *v1Distant=DataArrayInt::New();
    DataArrayDouble *v2Distant=DataArrayDouble::New();
    //serialization of local mesh to send data to distant proc.
    local_mesh->serialize(v1Local,v2Local);
    //Building the right instance of copy of distant mesh.
    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;
    if(v1Local)
      {
        nbLocalElems=v1Local->getNbOfElems();
        ptLocal=v1Local->getPointer();
      }
    if(v1Distant)
      {
        nbDistElem=v1Distant->getNbOfElems();
        ptDist=v1Distant->getPointer();
      }
    comm_interface.sendRecv(ptLocal, nbLocalElems, MPI_INT,
                            iprocdistant_in_union, 1111,
                            ptDist, nbDistElem, MPI_INT,
                            iprocdistant_in_union,1111,
                            *comm, &status);
    nbLocalElems=0;
    double *ptLocal2=0;
    double *ptDist2=0;
    if(v2Local)
      {
        nbLocalElems=v2Local->getNbOfElems();
        ptLocal2=v2Local->getPointer();
      }
    nbDistElem=0;
    if(v2Distant)
      {
        nbDistElem=v2Distant->getNbOfElems();
        ptDist2=v2Distant->getPointer();
      }
    comm_interface.sendRecv(ptLocal2, nbLocalElems, MPI_DOUBLE,
                            iprocdistant_in_union, 1112,
                            ptDist2, nbDistElem, MPI_DOUBLE,
                            iprocdistant_in_union, 1112, 
                            *comm, &status);
    //
    distant_mesh=distant_mesh_tmp;
    //finish unserialization
    distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
    //
    distant_ids_recv=new int[tinyInfoDistant.back()];
    comm_interface.sendRecv((void *)distant_ids_send->getConstPointer(),tinyInfoLocal.back(), MPI_INT,
                            iprocdistant_in_union, 1113,
                            distant_ids_recv,tinyInfoDistant.back(), MPI_INT,
                            iprocdistant_in_union,1113,
                            *comm, &status);
    if(v1Local)
      v1Local->decrRef();
    if(v2Local)
      v2Local->decrRef();
    if(v1Distant)
      v1Distant->decrRef();
    if(v2Distant)
      v2Distant->decrRef();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 199 of file ElementLocator.cxx.

  {
#ifdef USE_DIRECTED_BB
    INTERP_KERNEL::DirectedBoundingBox local_dbb, distant_dbb;
    local_dbb.setData( _domain_bounding_boxes+_union_group->myRank()*local_dbb.dataSize( _local_cell_mesh_space_dim ));
    distant_dbb.setData( _domain_bounding_boxes+irank*distant_dbb.dataSize( _local_cell_mesh_space_dim ));
    return !local_dbb.isDisjointWith( distant_dbb );
#else
    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;

    for (int idim=0; idim < _local_cell_mesh_space_dim; idim++)
      {
        const double eps =  1e-12;
        bool intersects = (distant_bb[idim*2]<local_bb[idim*2+1]+eps)
          && (local_bb[idim*2]<distant_bb[idim*2+1]+eps);
        if (!intersects) return false; 
      }
    return true;
#endif
  } 

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::exchangeMesh ( int  idistantrank,
MEDCouplingPointSet *&  target_mesh,
int *&  distant_ids 
)

Definition at line 81 of file ElementLocator.cxx.

  {
    int rank = _union_group->translateRank(&_distant_group,idistantrank);

    if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end())
      return;
   
    vector<int> elems;
#ifdef USE_DIRECTED_BB
    INTERP_KERNEL::DirectedBoundingBox dbb;
    double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim);
    dbb.setData(distant_bb);
    _local_cell_mesh->getCellsInBoundingBox(dbb,getBoundingBoxAdjustment(),elems);
#else
    double* distant_bb = _domain_bounding_boxes+rank*2*_local_cell_mesh_space_dim;
    _local_cell_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment(),elems);
#endif
    
    DataArrayInt *distant_ids_send;
    MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(&elems[0],&elems[elems.size()],distant_ids_send);
    _exchangeMesh(send_mesh, distant_mesh, idistantrank, distant_ids_send, distant_ids);
    distant_ids_send->decrRef();
    
    if(send_mesh)
      send_mesh->decrRef();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::exchangeMethod ( const std::string &  sourceMeth,
int  idistantrank,
std::string &  targetMeth 
)

Definition at line 110 of file ElementLocator.cxx.

  {
    CommInterface comm_interface=_union_group->getCommInterface();
    MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
    const MPI_Comm* comm=(group->getComm());
    MPI_Status status;
    // it must be converted to union numbering before communication
    int idistRankInUnion = group->translateRank(&_distant_group,idistantrank);
    char *recv_buffer=new char[4];
    std::vector<char> send_buffer(4);
    std::copy(sourceMeth.begin(),sourceMeth.end(),send_buffer.begin());
    comm_interface.sendRecv(&send_buffer[0], 4, MPI_CHAR,idistRankInUnion, 1112,
                            recv_buffer, 4, MPI_CHAR,idistRankInUnion, 1112,
                            *comm, &status);
    targetMeth=recv_buffer;
    delete [] recv_buffer;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const MPI_Comm * ParaMEDMEM::ElementLocator::getCommunicator ( ) const

Definition at line 62 of file ElementLocator.cxx.

  {
    MPIProcessorGroup* group=static_cast<MPIProcessorGroup*> (_union_group);
    return group->getComm();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::vector<int>& ParaMEDMEM::ElementLocator::getDistantProcIds ( ) const [inline]

Definition at line 49 of file ElementLocator.hxx.

{ return _distant_proc_ids; }

Here is the caller graph for this function:

Definition at line 68 of file ElementLocator.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ParaMEDMEM::ElementLocator::isM1DCorr ( ) const [inline]

This method is used to informed if there is -1D mesh on distant_group side or on local_group side.

Definition at line 53 of file ElementLocator.hxx.

{ return _is_m1d_corr; }

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::recvAddElementsFromLazyProcsW ( std::vector< std::vector< int > > &  elementsToAdd)

connected with ElementLocator::sendAddElementsToWorkingSideL

Definition at line 461 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    MPI_Status status;
    int lgth=_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];
        comm.recv(&locLgth,1,MPI_INT,*iter,1130,*_comm,&status);
        eltToFeed.resize(locLgth);
        comm.recv(&eltToFeed[0],locLgth,MPI_INT,*iter,1131,*_comm,&status);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Foreach working procs Wi compute and push it in _ids_per_working_proc3, if it exist, local id of nodes that are in interaction with an another lazy proc than this and that exists in this but with no interaction with this.

The computation is performed here. sendAddElementsToWorkingSideL is only in charge to send precomputed _ids_per_working_proc3 attribute. connected with ElementLocator::sendCandidatesForAddElementsW

Definition at line 631 of file ElementLocator.cxx.

  {
    int procId=0;
    int 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);
    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++)
          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());
        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];
        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;
      }
    if(globalIds)
      globalIds->decrRef();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW ( std::vector< std::vector< int > > &  globalIds)

connected with ElementLocator::sendCandidatesGlobalIdsToWorkingSideL

Definition at line 411 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    MPI_Status status;
    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];
        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);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

connected with ElementLocator::sendSumToLazySideW

Definition at line 501 of file ElementLocator.cxx.

  {
    _values_added.resize(_local_para_field.getField()->getNumberOfTuples());
    int procId=0;
    CommInterface comm;
    _ids_per_working_proc.resize(_distant_proc_ids.size());
    MPI_Status status;
    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,1114,*_comm,&status);
        vector<int>& 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(&values[0],lgth,MPI_DOUBLE,*iter,1116,*_comm,&status);
        for(int i=0;i<lgth;i++)
          _values_added[ids[i]]+=values[i];
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::recvGlobalIdsFromLazyProcsW ( const std::vector< std::vector< int > > &  distantLocEltIds,
std::vector< std::vector< int > > &  globalIds 
)

connected with ElementLocator::sendGlobalIdsToWorkingSideL

Definition at line 393 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    MPI_Status status;
    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];
        global.resize(vec.size());
        comm.recv(&global[0],vec.size(),MPI_INT,*iter,1123,*_comm,&status);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

connected with ElementLocator::sendLocalIdsToLazyProcsW

Definition at line 545 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    _ids_per_working_proc.resize(_distant_proc_ids.size());
    MPI_Status status;
    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];
        comm.recv(&lgth,1,MPI_INT,*iter,1121,*_comm,&status);
        ids.resize(lgth);
        comm.recv(&ids[0],lgth,MPI_INT,*iter,1122,*_comm,&status);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::recvPolicyFromLazySideW ( std::vector< int > &  policy)

connected with ElementLocator::sendPolicyToWorkingSideL

Definition at line 327 of file ElementLocator.cxx.

  {
    policy.resize(_distant_proc_ids.size());
    int procId=0;
    CommInterface comm;
    MPI_Status status;
    for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
      {
        int toRecv;
        comm.recv((void *)&toRecv,1,MPI_INT,*iter,1120,*_comm,&status);
        policy[procId]=toRecv;
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::recvSumFromLazySideW ( std::vector< std::vector< double > > &  globalSumRelToDistantIds)

connected with ElementLocator::sendToWorkingSideL

Definition at line 362 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    MPI_Status status;
    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);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

connected with ElementLocator::sendPartialSumToLazyProcsW

Definition at line 586 of file ElementLocator.cxx.

  {
    int procId=0;
    int 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;
    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<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(&vals[0],lgth,MPI_DOUBLE,*iter,1126,*_comm,&status);
        vector<int>::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<double>& vals=_values_per_working_proc[procId];
        vector<int>::const_iterator iter1=ids.begin();
        vector<double>::iterator iter2=vals.begin();
        for(;iter1!=ids.end();iter1++,iter2++)
          *iter2=sums[*iter1];
        ids.clear();
      }
  }

Here is the call graph for this function:

connected with ElementLocator::recvAddElementsFromLazyProcsW

Definition at line 673 of file ElementLocator.cxx.

  {
    int procId=0;
    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();
        comm.send((void *)&size,1,MPI_INT,*iter,1130,*_comm);
        comm.send((void *)&vals[0],size,MPI_INT,*iter,1131,*_comm);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::sendCandidatesForAddElementsW ( const std::vector< int > &  distantGlobIds)

connected with ElementLocator::recvCandidatesForAddElementsL

Definition at line 446 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    int lgth=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,1128,*_comm);
        comm.send((void*)&distantGlobIds[0],lgth,MPI_INT,*iter,1129,*_comm);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

This method sends to working side Wi only nodes in interaction with Wi and located on boundary, to reduce number.

connected with ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW

Definition at line 690 of file ElementLocator.cxx.

  { 
    int procId=0;
    CommInterface comm;
    DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
    const int *globalIdsC=globalIds->getConstPointer();
    std::vector<int> candidates;
    _local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(candidates);
    for(std::vector<int>::iterator iter1=candidates.begin();iter1!=candidates.end();iter1++)
      (*iter1)=globalIdsC[*iter1];
    std::set<int> 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++)
          *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();
        comm.send(&lgth,1,MPI_INT,*iter,1132,*_comm);
        comm.send(&tmp3[0],lgth,MPI_INT,*iter,1133,*_comm);
      }
    if(globalIds)
      globalIds->decrRef();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

connected with ElementLocator::recvGlobalIdsFromLazyProcsW

Definition at line 564 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
    const int *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++)
          *iter1=globalIdsC[*iter2];
        comm.send(&valsToSend[0],ids.size(),MPI_INT,*iter,1123,*_comm);
      }
    if(globalIds)
      globalIds->decrRef();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::sendLocalIdsToLazyProcsW ( const std::vector< std::vector< int > > &  distantLocEltIds)

connected with ElementLocator::recvLocalIdsFromWorkingSideL

Definition at line 377 of file ElementLocator.cxx.

  {
    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();
        comm.send(&lgth,1,MPI_INT,*iter,1121,*_comm);
        comm.send((void *)&eltIds[0],lgth,MPI_INT,*iter,1122,*_comm);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::sendPartialSumToLazyProcsW ( const std::vector< int > &  distantGlobIds,
const std::vector< double > &  sum 
)

connected with ElementLocator::recvSumFromWorkingSideL

Definition at line 430 of file ElementLocator.cxx.

  {
    int procId=0;
    CommInterface comm;
    int lgth=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((void*)&distantGlobIds[0],lgth,MPI_INT,*iter,1125,*_comm);
        comm.send((void*)&sum[0],lgth,MPI_DOUBLE,*iter,1126,*_comm);
      }
  }

Here is the call graph for this function:

connected with ElementLocator::recvPolicyFromLazySideW

Definition at line 481 of file ElementLocator.cxx.

  {
    CommInterface comm;
    int toSend;
    DataArrayInt *isCumulative=_local_para_field.returnCumulativeGlobalNumbering();
    if(isCumulative)
      {
        toSend=CUMULATIVE_POLICY;
        isCumulative->decrRef();
      }
    else
      toSend=NO_POST_TREATMENT_POLICY;
    for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++)
      comm.send(&toSend,1,MPI_INT,*iter,1120,*_comm);
    return toSend;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::ElementLocator::sendSumToLazySideW ( const std::vector< std::vector< int > > &  distantLocEltIds,
const std::vector< std::vector< double > > &  partialSumRelToDistantIds 
)

connected with ElementLocator::recvFromWorkingSideL

Definition at line 344 of file ElementLocator.cxx.

  {
    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<double>& valued=partialSumRelToDistantIds[procId];
        int lgth=eltIds.size();
        comm.send(&lgth,1,MPI_INT,*iter,1114,*_comm);
        comm.send((void *)&eltIds[0],lgth,MPI_INT,*iter,1115,*_comm);
        comm.send((void *)&valued[0],lgth,MPI_DOUBLE,*iter,1116,*_comm);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

connected with ElementLocator::recvSumFromLazySideW

Definition at line 525 of file ElementLocator.cxx.

  {
    int procId=0;
    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<double> valsToSend(ids.size());
        vector<double>::iterator iter3=valsToSend.begin();
        for(vector<int>::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);
        //ids.clear();
      }
    //_ids_per_working_proc.clear();
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const MPI_Comm* ParaMEDMEM::ElementLocator::_comm [private]

Definition at line 96 of file ElementLocator.hxx.

Definition at line 89 of file ElementLocator.hxx.

Definition at line 90 of file ElementLocator.hxx.

Definition at line 92 of file ElementLocator.hxx.

Definition at line 95 of file ElementLocator.hxx.

Definition at line 91 of file ElementLocator.hxx.

std::vector< std::vector<int> > ParaMEDMEM::ElementLocator::_ids_per_working_proc [private]

Definition at line 99 of file ElementLocator.hxx.

std::vector< std::vector<int> > ParaMEDMEM::ElementLocator::_ids_per_working_proc3 [private]

Definition at line 100 of file ElementLocator.hxx.

Definition at line 87 of file ElementLocator.hxx.

Definition at line 85 of file ElementLocator.hxx.

Definition at line 86 of file ElementLocator.hxx.

Definition at line 88 of file ElementLocator.hxx.

Definition at line 93 of file ElementLocator.hxx.

Definition at line 84 of file ElementLocator.hxx.

Definition at line 94 of file ElementLocator.hxx.

std::vector<double> ParaMEDMEM::ElementLocator::_values_added [private]

Definition at line 98 of file ElementLocator.hxx.

std::vector< std::vector<double> > ParaMEDMEM::ElementLocator::_values_per_working_proc [private]

Definition at line 101 of file ElementLocator.hxx.

Definition at line 103 of file ElementLocator.hxx.

Definition at line 104 of file ElementLocator.hxx.


The documentation for this class was generated from the following files: