add proc option to compute property/grid
This commit is contained in:
@ -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
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -65,6 +65,7 @@ class ComputePropertyGrid : public Compute {
|
||||
FnPtrPack *pack_choice; // ptrs to pack functions
|
||||
|
||||
void pack_id(int);
|
||||
void pack_proc(int);
|
||||
template <int IDIM> void pack_indices(int);
|
||||
template <int POS, int MODE, int IDIM> void pack_coords(int);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user