Missed changes

This commit is contained in:
Stan Gerald Moore
2024-02-26 16:34:42 -07:00
parent 82762937a8
commit 214ea5209e
2 changed files with 24 additions and 14 deletions

View File

@ -54,7 +54,7 @@ CommTiled::CommTiled(LAMMPS *lmp) : Comm(lmp)
rcbinfo = nullptr;
cutghostmulti = nullptr;
cutghostmultiold = nullptr;
init_buffers();
init_buffers_flag = 1;
}
/* ---------------------------------------------------------------------- */
@ -69,7 +69,7 @@ CommTiled::CommTiled(LAMMPS * /*lmp*/, Comm *oldcomm) : Comm(*oldcomm)
style = Comm::TILED;
layout = oldcomm->layout;
Comm::copy_arrays(oldcomm);
init_buffers();
init_buffers_flag = 1;
}
/* ---------------------------------------------------------------------- */
@ -94,7 +94,7 @@ void CommTiled::init_buffers()
buf_send = buf_recv = nullptr;
maxsend = maxrecv = BUFMIN;
grow_send(maxsend,2);
memory->create(buf_recv,maxrecv,"comm:buf_recv");
grow_recv(maxrecv,1);
maxoverlap = 0;
overlap = nullptr;
@ -113,6 +113,11 @@ void CommTiled::init_buffers()
void CommTiled::init()
{
if (init_buffers_flag) {
init_buffers();
init_buffers_flag = 0;
}
Comm::init();
// cannot set nswap in init_buffers() b/c
@ -2236,12 +2241,15 @@ void CommTiled::grow_send(int n, int flag)
}
/* ----------------------------------------------------------------------
free/malloc the size of the recv buffer as needed with BUFFACTOR
free/malloc the size of the recv buffer as needed
flag = 0, realloc with BUFFACTOR
flag = 1, free/malloc w/out BUFFACTOR
------------------------------------------------------------------------- */
void CommTiled::grow_recv(int n)
void CommTiled::grow_recv(int n, int flag)
{
maxrecv = static_cast<int> (BUFFACTOR * n);
if (flag) maxrecv = n;
else maxrecv = static_cast<int> (BUFFACTOR * n);
memory->destroy(buf_recv);
memory->create(buf_recv,maxrecv,"comm:buf_recv");
}
@ -2428,9 +2436,11 @@ void CommTiled::deallocate_swap(int n)
delete [] maxsendlist[i];
if (sendlist && sendlist[i]) {
for (int j = 0; j < nprocmax[i]; j++) memory->destroy(sendlist[i][j]);
delete [] sendlist[i];
}
}
delete [] sendproc;
delete [] recvproc;

View File

@ -51,7 +51,7 @@ class CommTiled : public Comm {
double memory_usage() override;
private:
protected:
int nswap; // # of swaps to perform = 2*dim
int maxswap; // largest nswap can be = 6
@ -117,7 +117,7 @@ class CommTiled : public Comm {
double *sublo, *subhi;
int dimension;
// NOTE: init_buffers is called from a constructor and must not be made virtual
int init_buffers_flag;
void init_buffers();
// box drop and other functions
@ -145,11 +145,11 @@ class CommTiled : public Comm {
int point_drop_tiled_recurse(double *, int, int);
int closer_subbox_edge(int, double *);
void grow_send(int, int); // reallocate send buffer
void grow_recv(int); // free/allocate recv buffer
void grow_list(int, int, int); // reallocate sendlist for one swap/proc
virtual void grow_send(int, int); // reallocate send buffer
virtual void grow_recv(int, int flag = 0); // free/allocate recv buffer
virtual void grow_list(int, int, int); // reallocate sendlist for one swap/proc
void allocate_swap(int); // allocate swap arrays
void grow_swap_send(int, int, int); // grow swap arrays for send and recv
virtual void grow_swap_send(int, int, int); // grow swap arrays for send and recv
void grow_swap_send_multi(int, int); // grow multi swap arrays for send and recv
void grow_swap_recv(int, int);
void deallocate_swap(int); // deallocate swap arrays