simplify library interface code to extract peratom or local data from computes

This commit is contained in:
Axel Kohlmeyer
2020-03-07 10:57:51 -05:00
parent 943540b015
commit 6f1d913e7e

View File

@ -537,35 +537,19 @@ void *lammps_extract_compute(void *ptr, char *id, int style, int type)
if (style == 1) { if (style == 1) {
if (!compute->peratom_flag) return NULL; if (!compute->peratom_flag) return NULL;
if (type == 1) { if (compute->invoked_peratom != lmp->update->ntimestep)
if (compute->invoked_peratom != lmp->update->ntimestep) compute->compute_peratom();
compute->compute_peratom(); if (type == 1) return (void *) compute->vector_atom;
return (void *) compute->vector_atom; if (type == 2) return (void *) compute->array_atom;
}
if (type == 2) {
if (compute->invoked_peratom != lmp->update->ntimestep)
compute->compute_peratom();
return (void *) compute->array_atom;
}
} }
if (style == 2) { if (style == 2) {
if (!compute->local_flag) return NULL; if (!compute->local_flag) return NULL;
if (type == 0) { if (compute->invoked_local != lmp->update->ntimestep)
if (compute->invoked_local != lmp->update->ntimestep) compute->compute_local();
compute->compute_local(); if (type == 0) return (void *) &compute->size_local_rows;
return (void *) &compute->size_local_rows; if (type == 1) return (void *) compute->vector_local;
} if (type == 2) return (void *) compute->array_local;
if (type == 1) {
if (compute->invoked_local != lmp->update->ntimestep)
compute->compute_local();
return (void *) compute->vector_local;
}
if (type == 2) {
if (compute->invoked_local != lmp->update->ntimestep)
compute->compute_local();
return (void *) compute->array_local;
}
} }
} }
END_CAPTURE END_CAPTURE