Adding files for BPM
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "bond.h"
|
||||
#include "compute.h"
|
||||
#include "domain.h"
|
||||
#include "dump.h"
|
||||
@ -1464,6 +1465,99 @@ void CommTiled::reverse_comm_pair(Pair *pair)
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
forward communication invoked by a Bond
|
||||
nsize used only to set recv buffer limit
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void CommTiled::forward_comm_bond(Bond *bond)
|
||||
{
|
||||
int i,irecv,n,nsend,nrecv;
|
||||
|
||||
int nsize = bond->comm_forward;
|
||||
|
||||
for (int iswap = 0; iswap < nswap; iswap++) {
|
||||
nsend = nsendproc[iswap] - sendself[iswap];
|
||||
nrecv = nrecvproc[iswap] - sendself[iswap];
|
||||
|
||||
if (recvother[iswap]) {
|
||||
for (i = 0; i < nrecv; i++)
|
||||
MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]],
|
||||
nsize*recvnum[iswap][i],
|
||||
MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]);
|
||||
}
|
||||
|
||||
if (sendother[iswap]) {
|
||||
for (i = 0; i < nsend; i++) {
|
||||
n = bond->pack_forward_comm(sendnum[iswap][i],sendlist[iswap][i],
|
||||
buf_send,pbc_flag[iswap][i],pbc[iswap][i]);
|
||||
MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap][i],0,world);
|
||||
}
|
||||
}
|
||||
|
||||
if (sendself[iswap]) {
|
||||
bond->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend],
|
||||
buf_send,pbc_flag[iswap][nsend],
|
||||
pbc[iswap][nsend]);
|
||||
bond->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],
|
||||
buf_send);
|
||||
}
|
||||
if (recvother[iswap]) {
|
||||
for (i = 0; i < nrecv; i++) {
|
||||
MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE);
|
||||
bond->unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv],
|
||||
&buf_recv[nsize*
|
||||
forward_recv_offset[iswap][irecv]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
reverse communication invoked by a Bond
|
||||
nsize used only to set recv buffer limit
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void CommTiled::reverse_comm_bond(Bond *bond)
|
||||
{
|
||||
int i,irecv,n,nsend,nrecv;
|
||||
|
||||
int nsize = MAX(bond->comm_reverse,bond->comm_reverse_off);
|
||||
|
||||
for (int iswap = nswap-1; iswap >= 0; iswap--) {
|
||||
nsend = nsendproc[iswap] - sendself[iswap];
|
||||
nrecv = nrecvproc[iswap] - sendself[iswap];
|
||||
|
||||
if (sendother[iswap]) {
|
||||
for (i = 0; i < nsend; i++)
|
||||
MPI_Irecv(&buf_recv[nsize*reverse_recv_offset[iswap][i]],
|
||||
nsize*sendnum[iswap][i],MPI_DOUBLE,
|
||||
sendproc[iswap][i],0,world,&requests[i]);
|
||||
}
|
||||
if (recvother[iswap]) {
|
||||
for (i = 0; i < nrecv; i++) {
|
||||
n = bond->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i],
|
||||
buf_send);
|
||||
MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world);
|
||||
}
|
||||
}
|
||||
if (sendself[iswap]) {
|
||||
bond->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],
|
||||
buf_send);
|
||||
bond->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend],
|
||||
buf_send);
|
||||
}
|
||||
if (sendother[iswap]) {
|
||||
for (i = 0; i < nsend; i++) {
|
||||
MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE);
|
||||
bond->unpack_reverse_comm(sendnum[iswap][irecv],sendlist[iswap][irecv],
|
||||
&buf_recv[nsize*
|
||||
reverse_recv_offset[iswap][irecv]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
forward communication invoked by a Fix
|
||||
size/nsize used only to set recv buffer limit
|
||||
|
||||
Reference in New Issue
Block a user