diff --git a/src/compute_property_grid.cpp b/src/compute_property_grid.cpp index 2b8df955ef..58fe20bd86 100644 --- a/src/compute_property_grid.cpp +++ b/src/compute_property_grid.cpp @@ -13,6 +13,7 @@ #include "compute_property_grid.h" +#include "comm.h" #include "domain.h" #include "error.h" #include "grid2d.h" @@ -59,6 +60,8 @@ ComputePropertyGrid::ComputePropertyGrid(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg], "id") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_id; + } else if (strcmp(arg[iarg], "proc") == 0) { + pack_choice[jarg] = &ComputePropertyGrid::pack_proc; } else if (strcmp(arg[iarg], "ix") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_indices<0>; @@ -321,6 +324,37 @@ void ComputePropertyGrid::pack_id(int n) } } +/* ---------------------------------------------------------------------- + grid point owning processor +------------------------------------------------------------------------- */ + +void ComputePropertyGrid::pack_proc(int n) +{ + int me = comm->me; + + if (dimension == 2) { + if (nvalues == 1) { + for (int iy = nylo_in; iy <= nyhi_in; iy++) + for (int ix = nxlo_in; ix <= nxhi_in; ix++) vec2d[iy][ix] = me; + } else { + for (int iy = nylo_in; iy <= nyhi_in; iy++) + for (int ix = nxlo_in; ix <= nxhi_in; ix++) array2d[iy][ix][n] = me; + } + } else if (dimension == 3) { + if (nvalues == 1) { + for (int iz = nzlo_in; iz <= nzhi_in; iz++) + for (int iy = nylo_in; iy <= nyhi_in; iy++) + for (int ix = nxlo_in; ix <= nxhi_in; ix++) + vec3d[iz][iy][ix] = me; + } else { + for (int iz = nzlo_in; iz <= nzhi_in; iz++) + for (int iy = nylo_in; iy <= nyhi_in; iy++) + for (int ix = nxlo_in; ix <= nxhi_in; ix++) + array3d[iz][iy][ix][n] = me; + } + } +} + /* ---------------------------------------------------------------------- grid indices via templating ------------------------------------------------------------------------- */ diff --git a/src/compute_property_grid.h b/src/compute_property_grid.h index 8a0ef63090..37badeb2eb 100644 --- a/src/compute_property_grid.h +++ b/src/compute_property_grid.h @@ -65,6 +65,7 @@ class ComputePropertyGrid : public Compute { FnPtrPack *pack_choice; // ptrs to pack functions void pack_id(int); + void pack_proc(int); template void pack_indices(int); template void pack_coords(int); };