Back to index

salome-med  6.5.0
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes
ParaMEDMEM::MxN_Mapping Class Reference

#include <MxN_Mapping.hxx>

Inheritance diagram for ParaMEDMEM::MxN_Mapping:
Inheritance graph
[legend]
Collaboration diagram for ParaMEDMEM::MxN_Mapping:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MxN_Mapping ()
 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)
 Method registering a new element for correspondence with a distant element.
void prepareSendRecv ()
void sendRecv (MEDCouplingFieldDouble &field)
void sendRecv (double *sendfield, MEDCouplingFieldDouble &field) const
 Exchanging field data between two groups of processes.
void reverseSendRecv (double *recvfield, MEDCouplingFieldDouble &field) const
 Exchanging field data between two groups of processes.
const std::vector< std::pair
< int, int > > & 
getSendingIds () const
const std::vector< int > & getSendProcsOffsets () const
void initialize ()
MPIAccessDECgetAccessDEC ()
const std::string & getMethod () const
def getMethod
void setMethod (const char *m)
def setMethod
TimeInterpolationMethod getTimeInterpolationMethod () const
def getTimeInterpolationMethod
void setTimeInterpolationMethod (TimeInterpolationMethod it)
def setTimeInterpolationMethod
bool getForcedRenormalization () const
def getForcedRenormalization
void setForcedRenormalization (bool dr)
def setForcedRenormalization
bool getAsynchronous () const
def getAsynchronous
void setAsynchronous (bool dr)
def setAsynchronous
AllToAllMethod getAllToAllMethod () const
def getAllToAllMethod
void setAllToAllMethod (AllToAllMethod sp)
def setAllToAllMethod

Public Attributes

 this

Protected Attributes

std::string _method
bool _asynchronous
TimeInterpolationMethod _timeInterpolationMethod
AllToAllMethod _allToAllMethod
bool _forcedRenormalization

Private Attributes

ProcessorGroup_union_group
MPIAccessDEC_access_DEC
int _nb_comps
std::vector< std::pair< int,
int > > 
_sending_ids
std::vector< int > _recv_ids
std::vector< int > _send_proc_offsets
std::vector< int > _recv_proc_offsets

Detailed Description

Definition at line 34 of file MxN_Mapping.hxx.


Constructor & Destructor Documentation

Definition at line 30 of file MxN_Mapping.cxx.

  {
  }
ParaMEDMEM::MxN_Mapping::MxN_Mapping ( const ProcessorGroup source_group,
const ProcessorGroup target_group,
const DECOptions dec_options 
)

Definition at line 35 of file MxN_Mapping.cxx.

Here is the call graph for this function:

Definition at line 45 of file MxN_Mapping.cxx.

  {
    delete _union_group;
    delete _access_DEC;
  }

Member Function Documentation

void ParaMEDMEM::MxN_Mapping::addElementFromSource ( int  distant_proc,
int  distant_element 
)

Method registering a new element for correspondence with a distant element.

Parameters:
distant_procproc rank of the distant processor (in terms of the union group)
distant_elementid of the element on the distant processor

Definition at line 57 of file MxN_Mapping.cxx.

  {
    _sending_ids.push_back(make_pair(distant_proc,distant_element));
    for (int i=distant_proc; i<_union_group->size(); i++)
      _send_proc_offsets[i+1]++;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 51 of file MxN_Mapping.hxx.

{ return _access_DEC; }

Here is the caller graph for this function:

Definition at line 69 of file DECOptions.hxx.

{ return _allToAllMethod; }

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.getAllToAllMethod (   self) [inherited]
getAllToAllMethod(self) -> AllToAllMethod

1

Definition at line 14967 of file ParaMEDMEM.py.

14967 
14968     def getAllToAllMethod(self):
14969         """
14970         getAllToAllMethod(self) -> AllToAllMethod
14971 
14972         1
14973         """
14974         return _ParaMEDMEM.DECOptions_getAllToAllMethod(self)

Here is the call graph for this function:

bool ParaMEDMEM::DECOptions::getAsynchronous ( ) const [inline, inherited]

Definition at line 66 of file DECOptions.hxx.

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.getAsynchronous (   self) [inherited]
getAsynchronous(self) -> bool

1

Definition at line 14951 of file ParaMEDMEM.py.

14951 
14952     def getAsynchronous(self):
14953         """
14954         getAsynchronous(self) -> bool
14955 
14956         1
14957         """
14958         return _ParaMEDMEM.DECOptions_getAsynchronous(self)

Here is the call graph for this function:

bool ParaMEDMEM::DECOptions::getForcedRenormalization ( ) const [inline, inherited]

Definition at line 63 of file DECOptions.hxx.

Here is the caller graph for this function:

getForcedRenormalization(self) -> bool

1

Definition at line 14935 of file ParaMEDMEM.py.

14935 
14936     def getForcedRenormalization(self):
14937         """
14938         getForcedRenormalization(self) -> bool
14939 
14940         1
14941         """
14942         return _ParaMEDMEM.DECOptions_getForcedRenormalization(self)

Here is the call graph for this function:

const std::string& ParaMEDMEM::DECOptions::getMethod ( ) const [inline, inherited]

Definition at line 57 of file DECOptions.hxx.

{ return _method; }

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.getMethod (   self) [inherited]
getMethod(self) -> string

1

Definition at line 14903 of file ParaMEDMEM.py.

14903 
14904     def getMethod(self):
14905         """
14906         getMethod(self) -> string
14907 
14908         1
14909         """
14910         return _ParaMEDMEM.DECOptions_getMethod(self)

Here is the call graph for this function:

const std::vector<std::pair<int,int> >& ParaMEDMEM::MxN_Mapping::getSendingIds ( ) const [inline]

Definition at line 47 of file MxN_Mapping.hxx.

{ return _sending_ids; }

Here is the caller graph for this function:

const std::vector<int>& ParaMEDMEM::MxN_Mapping::getSendProcsOffsets ( ) const [inline]

Definition at line 48 of file MxN_Mapping.hxx.

{ return _send_proc_offsets; }

Definition at line 60 of file DECOptions.hxx.

Here is the caller graph for this function:

getTimeInterpolationMethod(self) -> TimeInterpolationMethod

1

Definition at line 14919 of file ParaMEDMEM.py.

14919 
14920     def getTimeInterpolationMethod(self):
14921         """
14922         getTimeInterpolationMethod(self) -> TimeInterpolationMethod
14923 
14924         1
14925         """
14926         return _ParaMEDMEM.DECOptions_getTimeInterpolationMethod(self)

Here is the call graph for this function:

Definition at line 64 of file MxN_Mapping.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 70 of file MxN_Mapping.cxx.

  {
    CommInterface comm_interface=_union_group->getCommInterface();
    // sending count pattern
    int* nbsend=new int[_union_group->size()];
    int* nbrecv=new int[_union_group->size()];
    for (int i=0; i<_union_group->size(); i++)
      {
        nbsend[i]=_send_proc_offsets[i+1]-_send_proc_offsets[i];
      }
  
    MPIProcessorGroup* group = static_cast<MPIProcessorGroup*>(_union_group);
    const MPI_Comm* comm=group->getComm();
    comm_interface.allToAll(nbsend, 1, MPI_INT,
                            nbrecv, 1, MPI_INT,
                            *comm);
         
    for (int i=0; i<_union_group->size(); i++)
      {
        for (int j=i+1;j<_union_group->size()+1; j++)
          _recv_proc_offsets[j]+=nbrecv[i];
    
      } 

    delete[] nbsend;
    delete[] nbrecv;

    _recv_ids.resize(_recv_proc_offsets[_union_group->size()]);
    int* isendbuf=0;
    int* irecvbuf=0;
    if (_sending_ids.size()>0)
      isendbuf = new int[_sending_ids.size()];
    if (_recv_ids.size()>0)  
      irecvbuf = new int[_recv_ids.size()];
    int* sendcounts = new int[_union_group->size()];
    int* senddispls=new int[_union_group->size()];
    int* recvcounts=new int[_union_group->size()];
    int* recvdispls=new int[_union_group->size()];
    for (int i=0; i< _union_group->size(); i++)
      {
        sendcounts[i]=_send_proc_offsets[i+1]-_send_proc_offsets[i];
        senddispls[i]=_send_proc_offsets[i];
        recvcounts[i]=_recv_proc_offsets[i+1]-_recv_proc_offsets[i];
        recvdispls[i]=_recv_proc_offsets[i];
      }
    vector<int> offsets = _send_proc_offsets;
    for (int i=0; i<(int)_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);
                           
    for (int i=0; i< _recv_proc_offsets[_union_group->size()]; i++)
      _recv_ids[i]=irecvbuf[i];                           
 
    if (_sending_ids.size()>0)
      delete[] isendbuf;
    if (_recv_ids.size()>0)  
      delete[] irecvbuf;
    delete[] sendcounts;
    delete[]recvcounts;
    delete[]senddispls;
    delete[] recvdispls;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::MxN_Mapping::reverseSendRecv ( double *  recvfield,
MEDCouplingFieldDouble field 
) const

Exchanging field data between two groups of processes.

Parameters:
fieldMEDCoupling field containing the values to be sent

The ids that were defined by addElementFromSource method are sent.

Definition at line 229 of file MxN_Mapping.cxx.

  {
    CommInterface comm_interface=_union_group->getCommInterface();
    const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);

    int nbcomp=field.getArray()->getNumberOfComponents();
    double* sendbuf=0;
    double* recvbuf=0;
    if (_recv_ids.size() >0)
      sendbuf = new double[_recv_ids.size()*nbcomp];
    if (_sending_ids.size()>0)
      recvbuf = new double[_sending_ids.size()*nbcomp];

    int* sendcounts = new int[_union_group->size()];
    int* senddispls=new int[_union_group->size()];
    int* recvcounts=new int[_union_group->size()];
    int* recvdispls=new int[_union_group->size()];

    for (int i=0; i< _union_group->size(); i++)
      {
        sendcounts[i]=nbcomp*(_recv_proc_offsets[i+1]-_recv_proc_offsets[i]);
        senddispls[i]=nbcomp*(_recv_proc_offsets[i]);
        recvcounts[i]=nbcomp*(_send_proc_offsets[i+1]-_send_proc_offsets[i]);
        recvdispls[i]=nbcomp*(_send_proc_offsets[i]);
      }
    //building the buffer of the elements to be sent
    vector<int> offsets = _recv_proc_offsets;
    DataArrayDouble *fieldArr=field.getArray();
    for (int iproc=0; iproc<_union_group->size();iproc++)
      for (int i=_recv_proc_offsets[iproc]; i<_recv_proc_offsets[iproc+1]; i++)
        {
          for (int icomp=0; icomp<nbcomp; icomp++)
            sendbuf[i*nbcomp+icomp]=fieldArr->getIJ(_recv_ids[i],icomp);
        }

    //communication phase
    switch (getAllToAllMethod())
      {
      case Native:
        {
          const MPI_Comm* comm = group->getComm();
          comm_interface.allToAllV(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
                                   recvbuf, recvcounts, recvdispls, MPI_DOUBLE,
                                   *comm);
        }
        break;
      case PointToPoint:
        _access_DEC->allToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
                               recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
        break;
      }

    //setting the received values in the field
    double* recvptr=recvbuf;                         
    for (int i=0; i< _send_proc_offsets[_union_group->size()]; i++)
      {
        for (int icomp=0; icomp<nbcomp; icomp++)
          {
            recvfield[i*nbcomp+icomp]=*recvptr;
            recvptr++;
          }
      }
    if (sendbuf!=0 && getAllToAllMethod() == Native)
      delete[] sendbuf;
    if (recvbuf!=0)
      delete[] recvbuf;
    delete[] sendcounts;
    delete[] recvcounts;
    delete[] senddispls; 
    delete[] recvdispls;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void ParaMEDMEM::MxN_Mapping::sendRecv ( double *  sendfield,
MEDCouplingFieldDouble field 
) const

Exchanging field data between two groups of processes.

Parameters:
fieldMEDCoupling field containing the values to be sent

The ids that were defined by addElementFromSource method are sent.

Definition at line 146 of file MxN_Mapping.cxx.

  {
    CommInterface comm_interface=_union_group->getCommInterface();
    const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
 
    int nbcomp=field.getArray()->getNumberOfComponents();
    double* sendbuf=0;
    double* recvbuf=0;
    if (_sending_ids.size() >0)
      sendbuf = new double[_sending_ids.size()*nbcomp];
    if (_recv_ids.size()>0)
      recvbuf = new double[_recv_ids.size()*nbcomp];
    
    int* sendcounts = new int[_union_group->size()];
    int* senddispls=new int[_union_group->size()];
    int* recvcounts=new int[_union_group->size()];
    int* recvdispls=new int[_union_group->size()];
  
    for (int i=0; i< _union_group->size(); i++)
      {
        sendcounts[i]=nbcomp*(_send_proc_offsets[i+1]-_send_proc_offsets[i]);
        senddispls[i]=nbcomp*(_send_proc_offsets[i]);
        recvcounts[i]=nbcomp*(_recv_proc_offsets[i+1]-_recv_proc_offsets[i]);
        recvdispls[i]=nbcomp*(_recv_proc_offsets[i]);
      }
    //building the buffer of the elements to be sent
    vector<int> offsets = _send_proc_offsets;

    for (int i=0; i<(int)_sending_ids.size();i++)
      { 
        int iproc = _sending_ids[i].first;
        for (int icomp=0; icomp<nbcomp; icomp++)
          sendbuf[offsets[iproc]*nbcomp+icomp]=sendfield[i*nbcomp+icomp];
        offsets[iproc]++;
      }
  
    //communication phase
    switch (getAllToAllMethod())
      {
      case Native:
        {
          const MPI_Comm* comm = group->getComm();
          comm_interface.allToAllV(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
                                   recvbuf, recvcounts, recvdispls, MPI_DOUBLE,
                                   *comm);
        }
        break;
      case PointToPoint:
        _access_DEC->allToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
                              recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
        break;
      }
  
    //setting the received values in the field
    DataArrayDouble *fieldArr=field.getArray();
    double* recvptr=recvbuf;                         
    for (int i=0; i< _recv_proc_offsets[_union_group->size()]; i++)
      {
        for (int icomp=0; icomp<nbcomp; icomp++)
          {
            double temp = fieldArr->getIJ(_recv_ids[i],icomp);
            fieldArr->setIJ(_recv_ids[i],icomp,temp+*recvptr);
            recvptr++;
          }
      }   
    if (sendbuf!=0 && getAllToAllMethod()== Native)
      delete[] sendbuf;
    if (recvbuf !=0)
      delete[] recvbuf;
    delete[] sendcounts;
    delete[] recvcounts;
    delete[] senddispls; 
    delete[] recvdispls;
  
  }

Here is the call graph for this function:

Definition at line 70 of file DECOptions.hxx.

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.setAllToAllMethod (   self,
  args 
) [inherited]
setAllToAllMethod(self, AllToAllMethod sp)

1

Definition at line 14975 of file ParaMEDMEM.py.

14975 
14976     def setAllToAllMethod(self, *args):
14977         """
14978         setAllToAllMethod(self, AllToAllMethod sp)
14979 
14980         1
14981         """
14982         return _ParaMEDMEM.DECOptions_setAllToAllMethod(self, *args)

Here is the call graph for this function:

void ParaMEDMEM::DECOptions::setAsynchronous ( bool  dr) [inline, inherited]

Definition at line 67 of file DECOptions.hxx.

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.setAsynchronous (   self,
  args 
) [inherited]
setAsynchronous(self, bool dr)

1

Definition at line 14959 of file ParaMEDMEM.py.

14959 
14960     def setAsynchronous(self, *args):
14961         """
14962         setAsynchronous(self, bool dr)
14963 
14964         1
14965         """
14966         return _ParaMEDMEM.DECOptions_setAsynchronous(self, *args)

Here is the call graph for this function:

void ParaMEDMEM::DECOptions::setForcedRenormalization ( bool  dr) [inline, inherited]

Definition at line 64 of file DECOptions.hxx.

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.setForcedRenormalization (   self,
  args 
) [inherited]
setForcedRenormalization(self, bool dr)

1

Definition at line 14943 of file ParaMEDMEM.py.

14943 
14944     def setForcedRenormalization(self, *args):
14945         """
14946         setForcedRenormalization(self, bool dr)
14947 
14948         1
14949         """
14950         return _ParaMEDMEM.DECOptions_setForcedRenormalization(self, *args)

Here is the call graph for this function:

void ParaMEDMEM::DECOptions::setMethod ( const char *  m) [inline, inherited]

Definition at line 58 of file DECOptions.hxx.

{ _method=m; }

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.setMethod (   self,
  args 
) [inherited]
setMethod(self, char m)

1

Definition at line 14911 of file ParaMEDMEM.py.

14911 
14912     def setMethod(self, *args):
14913         """
14914         setMethod(self, char m)
14915 
14916         1
14917         """
14918         return _ParaMEDMEM.DECOptions_setMethod(self, *args)

Here is the call graph for this function:

Definition at line 61 of file DECOptions.hxx.

Here is the caller graph for this function:

def ParaMEDMEM.DECOptions.setTimeInterpolationMethod (   self,
  args 
) [inherited]
setTimeInterpolationMethod(self, TimeInterpolationMethod it)

1

Definition at line 14927 of file ParaMEDMEM.py.

14927 
14928     def setTimeInterpolationMethod(self, *args):
14929         """
14930         setTimeInterpolationMethod(self, TimeInterpolationMethod it)
14931 
14932         1
14933         """
14934         return _ParaMEDMEM.DECOptions_setTimeInterpolationMethod(self, *args)

Here is the call graph for this function:


Member Data Documentation

Definition at line 54 of file MxN_Mapping.hxx.

Definition at line 37 of file DECOptions.hxx.

bool ParaMEDMEM::DECOptions::_asynchronous [protected, inherited]

Definition at line 35 of file DECOptions.hxx.

Definition at line 38 of file DECOptions.hxx.

std::string ParaMEDMEM::DECOptions::_method [protected, inherited]

Reimplemented in ParaMEDMEM::NonCoincidentDEC.

Definition at line 34 of file DECOptions.hxx.

Definition at line 55 of file MxN_Mapping.hxx.

std::vector<int> ParaMEDMEM::MxN_Mapping::_recv_ids [private]

Definition at line 57 of file MxN_Mapping.hxx.

std::vector<int> ParaMEDMEM::MxN_Mapping::_recv_proc_offsets [private]

Definition at line 59 of file MxN_Mapping.hxx.

std::vector<int> ParaMEDMEM::MxN_Mapping::_send_proc_offsets [private]

Definition at line 58 of file MxN_Mapping.hxx.

std::vector<std::pair<int,int> > ParaMEDMEM::MxN_Mapping::_sending_ids [private]

Definition at line 56 of file MxN_Mapping.hxx.

Definition at line 36 of file DECOptions.hxx.

Definition at line 53 of file MxN_Mapping.hxx.

Reimplemented in ParaMEDMEM::StructuredCoincidentDEC, and ParaMEDMEM::InterpKernelDEC.

Definition at line 14902 of file ParaMEDMEM.py.


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