Reverse communication compute fragment/aggregate
This commit is contained in:
@ -51,6 +51,7 @@ ComputeAggregateAtom::ComputeAggregateAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
peratom_flag = 1;
|
||||
size_peratom_cols = 0;
|
||||
comm_forward = 1;
|
||||
comm_reverse = 1;
|
||||
|
||||
nmax = 0;
|
||||
}
|
||||
@ -163,6 +164,11 @@ void ComputeAggregateAtom::compute_peratom()
|
||||
while (1) {
|
||||
comm->forward_comm_compute(this);
|
||||
|
||||
// reverse communication when bonds are not stored on every processor
|
||||
|
||||
if (force->newton_bond)
|
||||
comm->reverse_comm_compute(this);
|
||||
|
||||
change = 0;
|
||||
while (1) {
|
||||
done = 1;
|
||||
@ -252,13 +258,50 @@ void ComputeAggregateAtom::unpack_forward_comm(int n, int first, double *buf)
|
||||
m = 0;
|
||||
last = first + n;
|
||||
if (commflag)
|
||||
for (i = first; i < last; i++) aggregateID[i] = buf[m++];
|
||||
for (i = first; i < last; i++) {
|
||||
double x = buf[m++];
|
||||
|
||||
// only overwrite ghost IDs with values lower than current ones
|
||||
|
||||
aggregateID[i] = MIN(x,aggregateID[i]);
|
||||
}
|
||||
else {
|
||||
int *mask = atom->mask;
|
||||
for (i = first; i < last; i++) mask[i] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int ComputeAggregateAtom::pack_reverse_comm(int n, int first, double *buf)
|
||||
{
|
||||
int i,m,last;
|
||||
|
||||
m = 0;
|
||||
last = first + n;
|
||||
for (i = first; i < last; i++) {
|
||||
buf[m++] = aggregateID[i];
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeAggregateAtom::unpack_reverse_comm(int n, int *list, double *buf)
|
||||
{
|
||||
int i,j,m;
|
||||
|
||||
m = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
double x = buf[m++];
|
||||
|
||||
// only overwrite local IDs with values lower than current ones
|
||||
|
||||
aggregateID[j] = MIN(x,aggregateID[j]);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of local atom-based array
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user