Ignore:
Timestamp:
Apr 5, 2013, 12:39:30 PM (13 years ago)
Author:
Julian Iseringhausen <julian.iseringhausen@…>
Children:
4a709e
Parents:
f57182
Message:

Merge stashed open boundary stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/units/particle/comm_mpi_particle.cpp

    rf57182 r8180d8  
    8787
    8888  for (int i=0; i<num_particles_local; ++i) {
    89     index = static_cast<Index>((Vector(&x[3*i]) - grid.Extent().Begin()) / grid.Extent().MeshWidth());
     89    index = grid.Global().GlobalBegin() + static_cast<Index>((Vector(&x[3*i]) - grid.Extent().Begin()) / grid.Extent().MeshWidth());
    9090    for (int j=0; j<size; ++j)
    9191      if (index.IsInBounds(begin_remote[j], end_remote[j])) {
    92         send_buffer_x[j].push_back(x[3*i+0]);
    93         send_buffer_x[j].push_back(x[3*i+1]);
    94         send_buffer_x[j].push_back(x[3*i+2]);
    95         send_buffer_q[j].push_back(q[i]);
    96         send_buffer_ind[j].push_back(i);
    97         break;
     92        send_buffer_x[j].push_back(x[3*i+0]);
     93        send_buffer_x[j].push_back(x[3*i+1]);
     94        send_buffer_x[j].push_back(x[3*i+2]);
     95        send_buffer_q[j].push_back(q[i]);
     96        send_buffer_ind[j].push_back(i);
     97        break;
    9898      }
    9999  }
     
    242242      for (int j=0; j<3; ++j)
    243243        if ((types.Offset()[i][j] < 0 && lc.Global().LocalBegin()[j] == 0) ||
    244             (types.Offset()[i][j] > 0 && lc.Global().LocalEnd()[j] == lc.Global().GlobalSize()[j]))
     244            (types.Offset()[i][j] > 0 && lc.Global().LocalEnd()[j] == lc.Global().GlobalEnd()[j]))
    245245          offset[j] = -1.0 * types.Offset()[i][j] * lc.Extent().Size()[j];
    246246        else
     
    248248
    249249      for (ind.X() = types.NB()[i].Starts().X(); ind.X() < types.NB()[i].Starts().X()+types.NB()[i].Subsizes().X(); ++ind.X())
    250         for (ind.Y() = types.NB()[i].Starts().Y(); ind.Y() < types.NB()[i].Starts().Y()+types.NB()[i].Subsizes().Y(); ++ind.Y())
    251           for (ind.Z() = types.NB()[i].Starts().Z(); ind.Z() < types.NB()[i].Starts().Z()+types.NB()[i].Subsizes().Z(); ++ind.Z())
    252             for (iter=lc(ind).begin(); iter!=lc(ind).end(); ++iter) {
     250        for (ind.Y() = types.NB()[i].Starts().Y(); ind.Y() < types.NB()[i].Starts().Y()+types.NB()[i].Subsizes().Y(); ++ind.Y())
     251          for (ind.Z() = types.NB()[i].Starts().Z(); ind.Z() < types.NB()[i].Starts().Z()+types.NB()[i].Subsizes().Z(); ++ind.Z())
     252            for (iter=lc(ind).begin(); iter!=lc(ind).end(); ++iter) {
    253253
    254254              for (int j=0; j<3; ++j)
     
    260260              assert(lc.Extent().Begin().IsComponentwiseLessOrEqual((*iter)->Pos() + offset + halo_length));
    261261              assert(lc.Extent().End().IsComponentwiseGreaterOrEqual((*iter)->Pos() + offset - halo_length));
    262             }
     262            }
    263263
    264264      send_size[i] = types.NB()[i].Buffer().size();
     
    266266
    267267      if (send_size[i] > 0)
    268         MPI_Isend(&types.NB()[i].Buffer().front(), send_size[i], MPI_DOUBLE,
    269                   types.NB()[i].Rank(), 4096+types.NB()[i].TagSend(),
    270                   comm_global, &Request());
     268        MPI_Isend(&types.NB()[i].Buffer().front(), send_size[i], MPI_DOUBLE,
     269            types.NB()[i].Rank(), 4096+types.NB()[i].TagSend(),
     270            comm_global, &Request());
    271271    }
    272272
     
    275275      MPI_Recv(&recv_size, 1, MPI_INT, types.Halo()[i].Rank(), 2048+types.Halo()[i].TagReceive(), comm_global, MPI_STATUS_IGNORE);
    276276      if (recv_size > 0) {
    277         types.Halo()[i].Buffer().resize(recv_size);
    278         MPI_Irecv(&types.Halo()[i].Buffer().front(), recv_size, MPI_DOUBLE,
    279                   types.Halo()[i].Rank(), 4096+types.Halo()[i].TagReceive(),
    280                   comm_global, &Request());
     277        types.Halo()[i].Buffer().resize(recv_size);
     278        MPI_Irecv(&types.Halo()[i].Buffer().front(), recv_size, MPI_DOUBLE,
     279            types.Halo()[i].Rank(), 4096+types.Halo()[i].TagReceive(),
     280            comm_global, &Request());
    281281      }
    282282    }
Note: See TracChangeset for help on using the changeset viewer.