1 #ifndef SRC_EXCHANGER_NEIGHBOR_EXCHANGER_HPP_
2 #define SRC_EXCHANGER_NEIGHBOR_EXCHANGER_HPP_
5 #include <athena/globals.hpp>
6 #include <athena/mesh/mesh.hpp>
9 #include <configure.hpp>
20 for (
auto &nb : pmb->pbval->neighbor) {
21 if (nb.snb.rank == Globals::my_rank) {
22 MeshBlock *neighbor = pmb->pmy_mesh->FindMeshBlock(nb.snb.gid);
25 exchanger->
recv_buffer_[nb.targetid].swap(send_buffer_[nb.bufid]);
26 exchanger->SetBoundaryStatus(nb.targetid, BoundaryStatus::arrived);
32 int ssize = send_buffer_[nb.bufid].size();
33 MPI_Isend(send_buffer_[nb.bufid].data(), ssize,
35 &req_mpi_send_[nb.bufid]);
44 for (
auto &nb : pmb->pbval->neighbor) {
45 if (nb.snb.rank == Globals::my_rank)
continue;
50 MPI_Probe(nb.snb.rank, tag, MPI_COMM_WORLD, &status);
53 recv_buffer_[nb.bufid].resize(rsize);
55 nb.snb.rank, tag, mpi_comm_, &req_mpi_recv_[nb.bufid]);
62 for (
auto &nb : pmb->pbval->neighbor) {
64 if (nb.snb.rank != Globals::my_rank)
65 MPI_Wait(&req_mpi_send_[nb.bufid], MPI_STATUS_IGNORE);
BufferType recv_buffer_[MessageTraits< T >::num_buffers]
void ClearBuffer(MeshBlock const *pmb) override
Clear buffer.
void Transfer(MeshBlock const *pmb, int n=-1) override
Send and receive data.
int create_mpi_tag(int lid, int tid, std::string name)
Traits class providing Message information for class T.