small bookkeeping changes
This commit is contained in:
@ -820,7 +820,7 @@ array. Example code snippets with this logic were listed above,
|
||||
Final notes
|
||||
^^^^^^^^^^^
|
||||
|
||||
Finally, here are two additional issues to pay attention to for
|
||||
Finally, here are some additional issues to pay attention to for
|
||||
writing any style command which uses distributed grids via the Grid2d
|
||||
or Grid3d class.
|
||||
|
||||
@ -833,3 +833,12 @@ it should have logic to instantiate either 2d or 3d grids and their
|
||||
associated data arrays, depending on the dimension of the simulation
|
||||
box. The :doc:`fix ave/grid <fix_ave_grid>` command is an example of
|
||||
such a command.
|
||||
|
||||
When a command maps its particles to the grid and updates grid cell
|
||||
values, it should check that it is not updating or accessing a grid
|
||||
cell value outside the range of its owned+ghost cells, and generate an
|
||||
error message if that is the case. This could happen, for example, if
|
||||
a particle has moved further than half the neighbor skin distance,
|
||||
because the neighbor list update criterion are not adequate to prevent
|
||||
it from happening. See the src/KSPACE/pppm.cpp file and its
|
||||
*particle_map()* method for an example of this kind of error check.
|
||||
|
||||
@ -1448,34 +1448,34 @@ void PairAmoeba::reset_grid()
|
||||
pack own values to buf to send to another proc
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairAmoeba::pack_forward_grid(int flag, void *vbuf, int nlist, int *list)
|
||||
void PairAmoeba::pack_forward_grid(int which, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
FFT_SCALAR *buf = (FFT_SCALAR *) vbuf;
|
||||
|
||||
if (flag == MPOLE_GRID) {
|
||||
if (which == MPOLE_GRID) {
|
||||
FFT_SCALAR *src = m_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == POLAR_GRID) {
|
||||
} else if (which == POLAR_GRID) {
|
||||
FFT_SCALAR *src = p_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == POLAR_GRIDC) {
|
||||
} else if (which == POLAR_GRIDC) {
|
||||
FFT_SCALAR *src = pc_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
buf[n++] = src[2*list[i]];
|
||||
buf[n++] = src[2*list[i]+1];
|
||||
}
|
||||
} else if (flag == DISP_GRID) {
|
||||
} else if (which == DISP_GRID) {
|
||||
FFT_SCALAR *src = d_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == INDUCE_GRID) {
|
||||
} else if (which == INDUCE_GRID) {
|
||||
FFT_SCALAR *src = i_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == INDUCE_GRIDC) {
|
||||
} else if (which == INDUCE_GRIDC) {
|
||||
FFT_SCALAR *src = ic_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
@ -1489,34 +1489,34 @@ void PairAmoeba::pack_forward_grid(int flag, void *vbuf, int nlist, int *list)
|
||||
unpack another proc's own values from buf and set own ghost values
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairAmoeba::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list)
|
||||
void PairAmoeba::unpack_forward_grid(int which, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
FFT_SCALAR *buf = (FFT_SCALAR *) vbuf;
|
||||
|
||||
if (flag == MPOLE_GRID) {
|
||||
if (which == MPOLE_GRID) {
|
||||
FFT_SCALAR *dest = m_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] = buf[i];
|
||||
} else if (flag == POLAR_GRID) {
|
||||
} else if (which == POLAR_GRID) {
|
||||
FFT_SCALAR *dest = p_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] = buf[i];
|
||||
} else if (flag == POLAR_GRIDC) {
|
||||
} else if (which == POLAR_GRIDC) {
|
||||
FFT_SCALAR *dest = pc_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
dest[2*list[i]] = buf[n++];
|
||||
dest[2*list[i]+1] = buf[n++];
|
||||
}
|
||||
} else if (flag == DISP_GRID) {
|
||||
} else if (which == DISP_GRID) {
|
||||
FFT_SCALAR *dest = d_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] = buf[i];
|
||||
} else if (flag == INDUCE_GRID) {
|
||||
} else if (which == INDUCE_GRID) {
|
||||
FFT_SCALAR *dest = i_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] = buf[i];
|
||||
} else if (flag == INDUCE_GRIDC) {
|
||||
} else if (which == INDUCE_GRIDC) {
|
||||
FFT_SCALAR *dest = ic_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
@ -1530,34 +1530,34 @@ void PairAmoeba::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list)
|
||||
pack ghost values into buf to send to another proc
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairAmoeba::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list)
|
||||
void PairAmoeba::pack_reverse_grid(int which, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
FFT_SCALAR *buf = (FFT_SCALAR *) vbuf;
|
||||
|
||||
if (flag == MPOLE_GRID) {
|
||||
if (which == MPOLE_GRID) {
|
||||
FFT_SCALAR *src = m_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == POLAR_GRID) {
|
||||
} else if (which == POLAR_GRID) {
|
||||
FFT_SCALAR *src = p_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == POLAR_GRIDC) {
|
||||
} else if (which == POLAR_GRIDC) {
|
||||
FFT_SCALAR *src = pc_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
buf[n++] = src[2*list[i]];
|
||||
buf[n++] = src[2*list[i]+1];
|
||||
}
|
||||
} else if (flag == DISP_GRID) {
|
||||
} else if (which == DISP_GRID) {
|
||||
FFT_SCALAR *src = d_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == INDUCE_GRID) {
|
||||
} else if (which == INDUCE_GRID) {
|
||||
FFT_SCALAR *src = i_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
buf[i] = src[list[i]];
|
||||
} else if (flag == INDUCE_GRIDC) {
|
||||
} else if (which == INDUCE_GRIDC) {
|
||||
FFT_SCALAR *src = ic_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
@ -1571,34 +1571,34 @@ void PairAmoeba::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list)
|
||||
unpack another proc's ghost values from buf and add to own values
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairAmoeba::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list)
|
||||
void PairAmoeba::unpack_reverse_grid(int which, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
FFT_SCALAR *buf = (FFT_SCALAR *) vbuf;
|
||||
|
||||
if (flag == MPOLE_GRID) {
|
||||
if (which == MPOLE_GRID) {
|
||||
FFT_SCALAR *dest = m_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] += buf[i];
|
||||
} else if (flag == POLAR_GRID) {
|
||||
} else if (which == POLAR_GRID) {
|
||||
FFT_SCALAR *dest = p_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] += buf[i];
|
||||
} else if (flag == POLAR_GRIDC) {
|
||||
} else if (which == POLAR_GRIDC) {
|
||||
FFT_SCALAR *dest = pc_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
dest[2*list[i]] += buf[n++];
|
||||
dest[2*list[i]+1] += buf[n++];
|
||||
}
|
||||
} else if (flag == DISP_GRID) {
|
||||
} else if (which == DISP_GRID) {
|
||||
FFT_SCALAR *dest = d_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] += buf[i];
|
||||
} else if (flag == INDUCE_GRID) {
|
||||
} else if (which == INDUCE_GRID) {
|
||||
FFT_SCALAR *dest = i_kspace->grid_brick_start;
|
||||
for (int i = 0; i < nlist; i++)
|
||||
dest[list[i]] += buf[i];
|
||||
} else if (flag == INDUCE_GRIDC) {
|
||||
} else if (which == INDUCE_GRIDC) {
|
||||
FFT_SCALAR *dest = ic_kspace->grid_brick_start;
|
||||
int n = 0;
|
||||
for (int i = 0; i < nlist; i++) {
|
||||
|
||||
@ -96,7 +96,7 @@ void FixTTMGrid::post_constructor()
|
||||
|
||||
if (infile) {
|
||||
read_electron_temperatures(infile);
|
||||
grid->forward_comm(Grid3d::FIX,this,1,sizeof(double),0,
|
||||
grid->forward_comm(Grid3d::FIX,this,0,1,sizeof(double),
|
||||
grid_buf1,grid_buf2,MPI_DOUBLE);
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ void FixTTMGrid::end_of_step()
|
||||
flangevin[i][2]*v[i][2]);
|
||||
}
|
||||
|
||||
grid->reverse_comm(Grid3d::FIX,this,1,sizeof(double),0,
|
||||
grid->reverse_comm(Grid3d::FIX,this,0,1,sizeof(double),
|
||||
grid_buf1,grid_buf2,MPI_DOUBLE);
|
||||
|
||||
// clang-format off
|
||||
@ -257,7 +257,7 @@ void FixTTMGrid::end_of_step()
|
||||
|
||||
// communicate new T_electron values to ghost grid points
|
||||
|
||||
grid->forward_comm(Grid3d::FIX,this,1,sizeof(double),0,
|
||||
grid->forward_comm(Grid3d::FIX,this,0,1,sizeof(double),
|
||||
grid_buf1,grid_buf2,MPI_DOUBLE);
|
||||
}
|
||||
}
|
||||
@ -310,7 +310,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename)
|
||||
called back to from Grid3d::read_file()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int FixTTMGrid::unpack_read_grid(char *buffer)
|
||||
int FixTTMGrid::unpack_read_grid(int /*nlines*/, char *buffer)
|
||||
{
|
||||
// loop over chunk of lines of grid point values
|
||||
// skip comment lines
|
||||
@ -524,7 +524,7 @@ void FixTTMGrid::reset_grid()
|
||||
memory->create(remap_buf1, nremap_buf1, "ttm/grid:remap_buf1");
|
||||
memory->create(remap_buf2, nremap_buf2, "ttm/grid:remap_buf2");
|
||||
|
||||
grid->remap(Grid3d::FIX,this,1,sizeof(double),remap_buf1,remap_buf2,MPI_DOUBLE);
|
||||
grid->remap(Grid3d::FIX,this,0,1,sizeof(double),remap_buf1,remap_buf2,MPI_DOUBLE);
|
||||
|
||||
memory->destroy(remap_buf1);
|
||||
memory->destroy(remap_buf2);
|
||||
@ -538,7 +538,7 @@ void FixTTMGrid::reset_grid()
|
||||
|
||||
// communicate temperatures to ghost cells on new grid
|
||||
|
||||
grid->forward_comm(Grid3d::FIX,this,1,sizeof(double),0,
|
||||
grid->forward_comm(Grid3d::FIX,this,0,1,sizeof(double),
|
||||
grid_buf1,grid_buf2,MPI_DOUBLE);
|
||||
|
||||
// zero new net_energy_transfer
|
||||
@ -553,7 +553,7 @@ void FixTTMGrid::reset_grid()
|
||||
pack own values to buf to send to another proc
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixTTMGrid::pack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *list)
|
||||
void FixTTMGrid::pack_forward_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *src = &T_electron[nzlo_out][nylo_out][nxlo_out];
|
||||
@ -565,7 +565,7 @@ void FixTTMGrid::pack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *lis
|
||||
unpack another proc's own values from buf and set own ghost values
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixTTMGrid::unpack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *list)
|
||||
void FixTTMGrid::unpack_forward_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *dest = &T_electron[nzlo_out][nylo_out][nxlo_out];
|
||||
@ -577,7 +577,7 @@ void FixTTMGrid::unpack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *l
|
||||
pack ghost values into buf to send to another proc
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixTTMGrid::pack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *list)
|
||||
void FixTTMGrid::pack_reverse_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *src = &net_energy_transfer[nzlo_out][nylo_out][nxlo_out];
|
||||
@ -589,7 +589,7 @@ void FixTTMGrid::pack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *lis
|
||||
unpack another proc's ghost values from buf and add to own values
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixTTMGrid::unpack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *list)
|
||||
void FixTTMGrid::unpack_reverse_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *dest = &net_energy_transfer[nzlo_out][nylo_out][nxlo_out];
|
||||
@ -601,7 +601,7 @@ void FixTTMGrid::unpack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *l
|
||||
pack old grid values to buf to send to another proc
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixTTMGrid::pack_remap_grid(void *vbuf, int nlist, int *list)
|
||||
void FixTTMGrid::pack_remap_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *src =
|
||||
@ -614,7 +614,7 @@ void FixTTMGrid::pack_remap_grid(void *vbuf, int nlist, int *list)
|
||||
unpack another proc's own values from buf and set own ghost values
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixTTMGrid::unpack_remap_grid(void *vbuf, int nlist, int *list)
|
||||
void FixTTMGrid::unpack_remap_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
auto buf = (double *) vbuf;
|
||||
double *dest = &T_electron[nzlo_out][nylo_out][nxlo_out];
|
||||
|
||||
@ -46,9 +46,9 @@ class FixTTMGrid : public FixTTM {
|
||||
void unpack_forward_grid(int, void *, int, int *) override;
|
||||
void pack_reverse_grid(int, void *, int, int *) override;
|
||||
void unpack_reverse_grid(int, void *, int, int *) override;
|
||||
void pack_remap_grid(void *, int, int *) override;
|
||||
void unpack_remap_grid(void *, int, int *) override;
|
||||
int unpack_read_grid(char *) override;
|
||||
void pack_remap_grid(int, void *, int, int *) override;
|
||||
void unpack_remap_grid(int, void *, int, int *) override;
|
||||
int unpack_read_grid(int, char *) override;
|
||||
void pack_write_grid(int, void *) override;
|
||||
void unpack_write_grid(int, void *, int *) override;
|
||||
|
||||
|
||||
@ -217,9 +217,9 @@ class Fix : protected Pointers {
|
||||
virtual void unpack_forward_grid(int, void *, int, int *){};
|
||||
virtual void pack_reverse_grid(int, void *, int, int *){};
|
||||
virtual void unpack_reverse_grid(int, void *, int, int *){};
|
||||
virtual void pack_remap_grid(void *, int, int *){};
|
||||
virtual void unpack_remap_grid(void *, int, int *){};
|
||||
virtual int unpack_read_grid(char *) {return 0;};
|
||||
virtual void pack_remap_grid(int, void *, int, int *){};
|
||||
virtual void unpack_remap_grid(int, void *, int, int *){};
|
||||
virtual int unpack_read_grid(int, char *) {return 0;};
|
||||
virtual void pack_write_grid(int, void *){};
|
||||
virtual void unpack_write_grid(int, void *, int *){};
|
||||
|
||||
|
||||
@ -1865,7 +1865,7 @@ void FixAveGrid::unpack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *l
|
||||
invoked for both GRID and ATOM mode
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixAveGrid::pack_remap_grid(void *vbuf, int nlist, int *list)
|
||||
void FixAveGrid::pack_remap_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
int i,j,m,iwindow;
|
||||
|
||||
@ -1892,7 +1892,7 @@ void FixAveGrid::pack_remap_grid(void *vbuf, int nlist, int *list)
|
||||
invoked for both GRID and ATOM mode
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixAveGrid::unpack_remap_grid(void *vbuf, int nlist, int *list)
|
||||
void FixAveGrid::unpack_remap_grid(int /*which*/, void *vbuf, int nlist, int *list)
|
||||
{
|
||||
int i,j,m,iwindow;
|
||||
|
||||
@ -2086,9 +2086,9 @@ void FixAveGrid::reset_grid()
|
||||
if (nremap_buf2) memory->create(remap_buf2, nper*nremap_buf2, "ave/grid:remap_buf2");
|
||||
|
||||
if (dimension == 2)
|
||||
grid2d->remap(Grid2d::FIX,this,nper,sizeof(double),remap_buf1,remap_buf2,MPI_DOUBLE);
|
||||
grid2d->remap(Grid2d::FIX,this,0,nper,sizeof(double),remap_buf1,remap_buf2,MPI_DOUBLE);
|
||||
else
|
||||
grid3d->remap(Grid3d::FIX,this,nper,sizeof(double),remap_buf1,remap_buf2,MPI_DOUBLE);
|
||||
grid3d->remap(Grid3d::FIX,this,0,nper,sizeof(double),remap_buf1,remap_buf2,MPI_DOUBLE);
|
||||
|
||||
memory->destroy(remap_buf1);
|
||||
memory->destroy(remap_buf2);
|
||||
|
||||
@ -35,8 +35,8 @@ class FixAveGrid : public Fix {
|
||||
|
||||
void pack_reverse_grid(int, void *, int, int *) override;
|
||||
void unpack_reverse_grid(int, void *, int, int *) override;
|
||||
void pack_remap_grid(void *, int, int *) override;
|
||||
void unpack_remap_grid(void *, int, int *) override;
|
||||
void pack_remap_grid(int, void *, int, int *) override;
|
||||
void unpack_remap_grid(int, void *, int, int *) override;
|
||||
|
||||
void reset_grid() override;
|
||||
|
||||
|
||||
@ -1083,29 +1083,29 @@ int Grid2d::ghost_adjacent_tiled()
|
||||
forward comm of my owned cells to other's ghost cells
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Grid2d::forward_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
void Grid2d::forward_comm(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
if (layout != Comm::LAYOUT_TILED) {
|
||||
if (caller == KSPACE)
|
||||
forward_comm_brick<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
forward_comm_brick<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
forward_comm_brick<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
forward_comm_brick<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
forward_comm_brick<Fix>((Fix *) ptr,nper,nbyte,which,
|
||||
forward_comm_brick<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
} else {
|
||||
if (caller == KSPACE)
|
||||
forward_comm_tiled<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
forward_comm_tiled<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
forward_comm_tiled<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
buf1,buf2,datatype);
|
||||
forward_comm_tiled<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
forward_comm_tiled<Fix>((Fix *) ptr,nper,nbyte,
|
||||
which,buf1,buf2,datatype);
|
||||
forward_comm_tiled<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1115,7 +1115,7 @@ void Grid2d::forward_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid2d::
|
||||
forward_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
forward_comm_brick(T *ptr, int which, int nper, int /*nbyte*/,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
int m;
|
||||
@ -1145,7 +1145,7 @@ forward_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid2d::
|
||||
forward_comm_tiled(T *ptr, int nper, int nbyte, int which,
|
||||
forward_comm_tiled(T *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *vbuf2, MPI_Datatype datatype)
|
||||
{
|
||||
int i,m,offset;
|
||||
@ -1188,28 +1188,28 @@ forward_comm_tiled(T *ptr, int nper, int nbyte, int which,
|
||||
reverse comm of my ghost cells to sum to owner cells
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Grid2d::reverse_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
void Grid2d::reverse_comm(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
if (layout != Comm::LAYOUT_TILED) {
|
||||
if (caller == KSPACE)
|
||||
reverse_comm_brick<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
reverse_comm_brick<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
reverse_comm_brick<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
reverse_comm_brick<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
reverse_comm_brick<Fix>((Fix *) ptr,nper,nbyte,which,
|
||||
reverse_comm_brick<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
} else {
|
||||
if (caller == KSPACE)
|
||||
reverse_comm_tiled<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
reverse_comm_tiled<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
reverse_comm_tiled<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
reverse_comm_tiled<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
reverse_comm_tiled<Fix>((Fix *) ptr,nper,nbyte,which,
|
||||
reverse_comm_tiled<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
}
|
||||
}
|
||||
@ -1220,7 +1220,7 @@ void Grid2d::reverse_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid2d::
|
||||
reverse_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
reverse_comm_brick(T *ptr, int which, int nper, int /*nbyte*/,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
int m;
|
||||
@ -1250,7 +1250,7 @@ reverse_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid2d::
|
||||
reverse_comm_tiled(T *ptr, int nper, int nbyte, int which,
|
||||
reverse_comm_tiled(T *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *vbuf2, MPI_Datatype datatype)
|
||||
{
|
||||
int i,m,offset;
|
||||
@ -1444,16 +1444,16 @@ void Grid2d::setup_remap(Grid2d *old, int &nremap_buf1, int &nremap_buf2)
|
||||
pack/unpack operations are performed by caller via callbacks
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Grid2d::remap(int caller, void *ptr, int nper, int nbyte,
|
||||
void Grid2d::remap(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
if (caller == FIX) remap_style<Fix>((Fix *) ptr,nper,nbyte,buf1,buf2,datatype);
|
||||
if (caller == FIX) remap_style<Fix>((Fix *) ptr,which,nper,nbyte,buf1,buf2,datatype);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
template < class T >
|
||||
void Grid2d::remap_style(T *ptr, int nper, int nbyte,
|
||||
void Grid2d::remap_style(T *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *vbuf2, MPI_Datatype datatype)
|
||||
{
|
||||
int i,m,offset;
|
||||
@ -1471,15 +1471,15 @@ void Grid2d::remap_style(T *ptr, int nper, int nbyte,
|
||||
// perform all sends to other procs
|
||||
|
||||
for (m = 0; m < nsend_remap; m++) {
|
||||
ptr->pack_remap_grid(buf1,send_remap[m].npack,send_remap[m].packlist);
|
||||
ptr->pack_remap_grid(which,buf1,send_remap[m].npack,send_remap[m].packlist);
|
||||
MPI_Send(buf1,nper*send_remap[m].npack,datatype,send_remap[m].proc,0,gridcomm);
|
||||
}
|
||||
|
||||
// perform remap to self if defined
|
||||
|
||||
if (self_remap) {
|
||||
ptr->pack_remap_grid(buf1,copy_remap.npack,copy_remap.packlist);
|
||||
ptr->unpack_remap_grid(buf1,copy_remap.nunpack,copy_remap.unpacklist);
|
||||
ptr->pack_remap_grid(which,buf1,copy_remap.npack,copy_remap.packlist);
|
||||
ptr->unpack_remap_grid(which,buf1,copy_remap.nunpack,copy_remap.unpacklist);
|
||||
}
|
||||
|
||||
// unpack all received data
|
||||
@ -1487,7 +1487,7 @@ void Grid2d::remap_style(T *ptr, int nper, int nbyte,
|
||||
for (i = 0; i < nrecv_remap; i++) {
|
||||
MPI_Waitany(nrecv_remap,requests_remap,&m,MPI_STATUS_IGNORE);
|
||||
offset = nper * recv_remap[m].offset * nbyte;
|
||||
ptr->unpack_remap_grid((void *) &buf2[offset],
|
||||
ptr->unpack_remap_grid(which,(void *) &buf2[offset],
|
||||
recv_remap[m].nunpack,recv_remap[m].unpacklist);
|
||||
}
|
||||
}
|
||||
@ -1525,7 +1525,7 @@ void Grid2d::read_file_style(T *ptr, FILE *fp, int nchunk, int maxline)
|
||||
int eof = utils::read_lines_from_file(fp, nchunk, maxline, buffer, me, world);
|
||||
if (eof) error->all(FLERR, "Unexpected end of grid data file");
|
||||
|
||||
nread += ptr->unpack_read_grid(buffer);
|
||||
nread += ptr->unpack_read_grid(nchunk,buffer);
|
||||
}
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
@ -48,7 +48,7 @@ class Grid2d : protected Pointers {
|
||||
void reverse_comm(int, void *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
void setup_remap(Grid2d *, int &, int &);
|
||||
void remap(int, void *, int, int, void *, void *, MPI_Datatype);
|
||||
void remap(int, void *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
void read_file(int, void *, FILE *, int, int);
|
||||
void write_file(int, void *, int, int, int, MPI_Datatype);
|
||||
@ -242,7 +242,7 @@ protected:
|
||||
template <class T> void reverse_comm_brick(T *, int, int, int, void *, void *, MPI_Datatype);
|
||||
template <class T> void reverse_comm_tiled(T *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
template <class T> void remap_style(T *, int, int, void *, void *, MPI_Datatype);
|
||||
template <class T> void remap_style(T *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
template <class T> void read_file_style(T *, FILE *, int, int);
|
||||
template <class T> void write_file_style(T *, int, int, int, MPI_Datatype);
|
||||
|
||||
@ -1251,29 +1251,29 @@ int Grid3d::ghost_adjacent_tiled()
|
||||
forward comm of my owned cells to other's ghost cells
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Grid3d::forward_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
void Grid3d::forward_comm(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
if (layout != Comm::LAYOUT_TILED) {
|
||||
if (caller == KSPACE)
|
||||
forward_comm_brick<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
forward_comm_brick<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
forward_comm_brick<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
forward_comm_brick<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
forward_comm_brick<Fix>((Fix *) ptr,nper,nbyte,which,
|
||||
forward_comm_brick<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
} else {
|
||||
if (caller == KSPACE)
|
||||
forward_comm_tiled<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
forward_comm_tiled<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
forward_comm_tiled<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
buf1,buf2,datatype);
|
||||
forward_comm_tiled<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
forward_comm_tiled<Fix>((Fix *) ptr,nper,nbyte,
|
||||
which,buf1,buf2,datatype);
|
||||
forward_comm_tiled<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1283,7 +1283,7 @@ void Grid3d::forward_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid3d::
|
||||
forward_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
forward_comm_brick(T *ptr, int which, int nper, int /*nbyte*/,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
int m;
|
||||
@ -1313,7 +1313,7 @@ forward_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid3d::
|
||||
forward_comm_tiled(T *ptr, int nper, int nbyte, int which,
|
||||
forward_comm_tiled(T *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *vbuf2, MPI_Datatype datatype)
|
||||
{
|
||||
int i,m,offset;
|
||||
@ -1356,28 +1356,28 @@ forward_comm_tiled(T *ptr, int nper, int nbyte, int which,
|
||||
reverse comm of my ghost cells to sum to owner cells
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Grid3d::reverse_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
void Grid3d::reverse_comm(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
if (layout != Comm::LAYOUT_TILED) {
|
||||
if (caller == KSPACE)
|
||||
reverse_comm_brick<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
reverse_comm_brick<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
reverse_comm_brick<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
reverse_comm_brick<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
reverse_comm_brick<Fix>((Fix *) ptr,nper,nbyte,which,
|
||||
reverse_comm_brick<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
} else {
|
||||
if (caller == KSPACE)
|
||||
reverse_comm_tiled<KSpace>((KSpace *) ptr,nper,nbyte,which,
|
||||
reverse_comm_tiled<KSpace>((KSpace *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == PAIR)
|
||||
reverse_comm_tiled<Pair>((Pair *) ptr,nper,nbyte,which,
|
||||
buf1,buf2,datatype);
|
||||
reverse_comm_tiled<Pair>((Pair *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
else if (caller == FIX)
|
||||
reverse_comm_tiled<Fix>((Fix *) ptr,nper,nbyte,which,
|
||||
reverse_comm_tiled<Fix>((Fix *) ptr,which,nper,nbyte,
|
||||
buf1,buf2,datatype);
|
||||
}
|
||||
}
|
||||
@ -1388,7 +1388,7 @@ void Grid3d::reverse_comm(int caller, void *ptr, int nper, int nbyte, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid3d::
|
||||
reverse_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
reverse_comm_brick(T *ptr, int which, int nper, int /*nbyte*/,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
int m;
|
||||
@ -1418,7 +1418,7 @@ reverse_comm_brick(T *ptr, int nper, int /*nbyte*/, int which,
|
||||
|
||||
template < class T >
|
||||
void Grid3d::
|
||||
reverse_comm_tiled(T *ptr, int nper, int nbyte, int which,
|
||||
reverse_comm_tiled(T *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *vbuf2, MPI_Datatype datatype)
|
||||
{
|
||||
int i,m,offset;
|
||||
@ -1615,16 +1615,16 @@ void Grid3d::setup_remap(Grid3d *old, int &nremap_buf1, int &nremap_buf2)
|
||||
pack/unpack operations are performed by caller via callbacks
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Grid3d::remap(int caller, void *ptr, int nper, int nbyte,
|
||||
void Grid3d::remap(int caller, void *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *buf2, MPI_Datatype datatype)
|
||||
{
|
||||
if (caller == FIX) remap_style<Fix>((Fix *) ptr,nper,nbyte,buf1,buf2,datatype);
|
||||
if (caller == FIX) remap_style<Fix>((Fix *) ptr,which,nper,nbyte,buf1,buf2,datatype);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
template < class T >
|
||||
void Grid3d::remap_style(T *ptr, int nper, int nbyte,
|
||||
void Grid3d::remap_style(T *ptr, int which, int nper, int nbyte,
|
||||
void *buf1, void *vbuf2, MPI_Datatype datatype)
|
||||
{
|
||||
int i,m,offset;
|
||||
@ -1642,15 +1642,15 @@ void Grid3d::remap_style(T *ptr, int nper, int nbyte,
|
||||
// perform all sends to other procs
|
||||
|
||||
for (m = 0; m < nsend_remap; m++) {
|
||||
ptr->pack_remap_grid(buf1,send_remap[m].npack,send_remap[m].packlist);
|
||||
ptr->pack_remap_grid(which,buf1,send_remap[m].npack,send_remap[m].packlist);
|
||||
MPI_Send(buf1,nper*send_remap[m].npack,datatype,send_remap[m].proc,0,gridcomm);
|
||||
}
|
||||
|
||||
// perform remap to self if defined
|
||||
|
||||
if (self_remap) {
|
||||
ptr->pack_remap_grid(buf1,copy_remap.npack,copy_remap.packlist);
|
||||
ptr->unpack_remap_grid(buf1,copy_remap.nunpack,copy_remap.unpacklist);
|
||||
ptr->pack_remap_grid(which,buf1,copy_remap.npack,copy_remap.packlist);
|
||||
ptr->unpack_remap_grid(which,buf1,copy_remap.nunpack,copy_remap.unpacklist);
|
||||
}
|
||||
|
||||
// unpack all received data
|
||||
@ -1658,7 +1658,7 @@ void Grid3d::remap_style(T *ptr, int nper, int nbyte,
|
||||
for (i = 0; i < nrecv_remap; i++) {
|
||||
MPI_Waitany(nrecv_remap,requests_remap,&m,MPI_STATUS_IGNORE);
|
||||
offset = nper * recv_remap[m].offset * nbyte;
|
||||
ptr->unpack_remap_grid((void *) &buf2[offset],
|
||||
ptr->unpack_remap_grid(which,(void *) &buf2[offset],
|
||||
recv_remap[m].nunpack,recv_remap[m].unpacklist);
|
||||
}
|
||||
}
|
||||
@ -1696,7 +1696,7 @@ void Grid3d::read_file_style(T *ptr, FILE *fp, int nchunk, int maxline)
|
||||
int eof = utils::read_lines_from_file(fp, nchunk, maxline, buffer, me, world);
|
||||
if (eof) error->all(FLERR, "Unexpected end of grid data file");
|
||||
|
||||
nread += ptr->unpack_read_grid(buffer);
|
||||
nread += ptr->unpack_read_grid(nchunk,buffer);
|
||||
}
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
@ -50,7 +50,7 @@ class Grid3d : protected Pointers {
|
||||
void reverse_comm(int, void *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
void setup_remap(Grid3d *, int &, int &);
|
||||
void remap(int, void *, int, int, void *, void *, MPI_Datatype);
|
||||
void remap(int, void *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
void read_file(int, void *, FILE *, int, int);
|
||||
void write_file(int, void *, int, int, int, MPI_Datatype);
|
||||
@ -247,7 +247,7 @@ class Grid3d : protected Pointers {
|
||||
template <class T> void reverse_comm_brick(T *, int, int, int, void *, void *, MPI_Datatype);
|
||||
template <class T> void reverse_comm_tiled(T *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
template <class T> void remap_style(T *, int, int, void *, void *, MPI_Datatype);
|
||||
template <class T> void remap_style(T *, int, int, int, void *, void *, MPI_Datatype);
|
||||
|
||||
template <class T> void read_file_style(T *, FILE *, int, int);
|
||||
template <class T> void write_file_style(T *, int, int, int, MPI_Datatype);
|
||||
|
||||
Reference in New Issue
Block a user