Skip to content
Permalink
Browse files

core: ghosts: Treat bonds as data_part

  • Loading branch information...
fweik committed Oct 25, 2019
1 parent 5192f35 commit 61d49e73009fd5c4ec214bd9aff178ac16adb106
Showing with 13 additions and 10 deletions.
  1. +11 −9 src/core/ghosts.cpp
  2. +2 −1 src/core/ghosts.hpp
@@ -193,10 +193,9 @@ static int calc_transmit_size(GhostCommunication &ghost_comm,
n_buffer_new = 0;
if (data_parts & GHOSTTRANS_PROPRTS) {
n_buffer_new += sizeof(ParticleProperties);
// sending size of bond lists
if (ghosts_have_bonds) {
n_buffer_new += sizeof(int);
}
}
if (data_parts & GHOSTTRANS_BONDS) {
n_buffer_new += sizeof(int);
}
if (data_parts & GHOSTTRANS_POSITION)
n_buffer_new += sizeof(ParticlePosition);
@@ -245,7 +244,7 @@ static void prepare_send_buffer(CommBuf &send_buffer,
if (data_parts & GHOSTTRANS_FORCE) {
archiver << part.f;
}
if (ghosts_have_bonds && (data_parts & GHOSTTRANS_PROPRTS)) {
if (data_parts & GHOSTTRANS_BONDS) {
archiver << static_cast<int>(part.bl.n);
bond_archiver << Utils::make_const_span(part.bl);
}
@@ -317,7 +316,7 @@ static void put_recv_buffer(CommBuf &recv_buffer,
if (data_parts & GHOSTTRANS_FORCE) {
archiver >> part.f;
}
if (ghosts_have_bonds && (data_parts & GHOSTTRANS_PROPRTS)) {
if (data_parts & GHOSTTRANS_BONDS) {
int n_bonds;
archiver >> n_bonds;
part.bl.resize(n_bonds);
@@ -360,9 +359,9 @@ static void cell_cell_transfer(GhostCommunication &ghost_comm,
Particle &part2 = dst_list->part[p];
if (data_parts & GHOSTTRANS_PROPRTS) {
part2.p = part1.p;
if (ghosts_have_bonds) {
part2.bl = part1.bl;
}
}
if (data_parts & GHOSTTRANS_BONDS) {
part2.bl = part1.bl;
}
if (data_parts & GHOSTTRANS_POSITION) {
/* ok, this is not nice, but perhaps fast */
@@ -412,6 +411,9 @@ void ghost_communicator(GhostCommunicator *gcr, unsigned int data_parts) {
if (ghosts_have_v && (data_parts & GHOSTTRANS_POSITION))
data_parts |= GHOSTTRANS_MOMENTUM;

if (ghosts_have_bonds && (data_parts & GHOSTTRANS_PROPRTS))
data_parts |= GHOSTTRANS_BONDS;

for (auto it = gcr->comm.begin(); it != gcr->comm.end(); ++it) {
GhostCommunication &ghost_comm = *it;
int const comm_type = ghost_comm.type & GHOST_JOBMASK;
@@ -134,7 +134,8 @@ enum : unsigned {
/// transfer \ref ParticleForce
GHOSTTRANS_FORCE = 16u,
/// resize the receiver particle arrays to the size of the senders
GHOSTTRANS_PARTNUM = 64u
GHOSTTRANS_PARTNUM = 64u,
GHOSTTRANS_BONDS = 128u
};

/** \name Data Types */

0 comments on commit 61d49e7

Please sign in to comment.
You can’t perform that action at this time.