Merge branch 'develop' into BPM
This commit is contained in:
99
src/dump.cpp
99
src/dump.cpp
@ -150,19 +150,19 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
|
||||
|
||||
Dump::~Dump()
|
||||
{
|
||||
delete [] id;
|
||||
delete [] style;
|
||||
delete [] filename;
|
||||
delete [] multiname;
|
||||
delete[] id;
|
||||
delete[] style;
|
||||
delete[] filename;
|
||||
delete[] multiname;
|
||||
|
||||
delete [] format;
|
||||
delete [] format_default;
|
||||
delete [] format_line_user;
|
||||
delete [] format_float_user;
|
||||
delete [] format_int_user;
|
||||
delete [] format_bigint_user;
|
||||
delete[] format;
|
||||
delete[] format_default;
|
||||
delete[] format_line_user;
|
||||
delete[] format_float_user;
|
||||
delete[] format_int_user;
|
||||
delete[] format_bigint_user;
|
||||
|
||||
delete [] refresh;
|
||||
delete[] refresh;
|
||||
|
||||
// format_column_user is deallocated by child classes that use it
|
||||
|
||||
@ -270,12 +270,12 @@ void Dump::init()
|
||||
reorderflag = 1;
|
||||
double range = maxall-minall + EPSILON;
|
||||
idlo = static_cast<tagint> (range*me/nprocs + minall);
|
||||
tagint idhi = static_cast<tagint> (range*(me+1)/nprocs + minall);
|
||||
auto idhi = static_cast<tagint> (range*(me+1)/nprocs + minall);
|
||||
|
||||
tagint lom1 = static_cast<tagint> ((idlo-1-minall)/range * nprocs);
|
||||
tagint lo = static_cast<tagint> ((idlo-minall)/range * nprocs);
|
||||
tagint him1 = static_cast<tagint> ((idhi-1-minall)/range * nprocs);
|
||||
tagint hi = static_cast<tagint> ((idhi-minall)/range * nprocs);
|
||||
auto lom1 = static_cast<tagint> ((idlo-1-minall)/range * nprocs);
|
||||
auto lo = static_cast<tagint> ((idlo-minall)/range * nprocs);
|
||||
auto him1 = static_cast<tagint> ((idhi-1-minall)/range * nprocs);
|
||||
auto hi = static_cast<tagint> ((idhi-minall)/range * nprocs);
|
||||
if (me && me == lom1) idlo--;
|
||||
else if (me && me != lo) idlo++;
|
||||
if (me+1 == him1) idhi--;
|
||||
@ -549,20 +549,7 @@ void Dump::openfile()
|
||||
if (multiproc) filecurrent = multiname;
|
||||
|
||||
if (multifile) {
|
||||
char *filestar = filecurrent;
|
||||
filecurrent = new char[strlen(filestar) + 16];
|
||||
char *ptr = strchr(filestar,'*');
|
||||
*ptr = '\0';
|
||||
if (padflag == 0)
|
||||
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s",
|
||||
filestar,update->ntimestep,ptr+1);
|
||||
else {
|
||||
char bif[8],pad[16];
|
||||
strcpy(bif,BIGINT_FORMAT);
|
||||
sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]);
|
||||
sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1);
|
||||
}
|
||||
*ptr = '*';
|
||||
filecurrent = utils::strdup(utils::star_subst(filecurrent, update->ntimestep, padflag));
|
||||
if (maxfiles > 0) {
|
||||
if (numfiles < maxfiles) {
|
||||
nameslist[numfiles] = utils::strdup(filecurrent);
|
||||
@ -594,7 +581,7 @@ void Dump::openfile()
|
||||
|
||||
// delete string with timestep replaced
|
||||
|
||||
if (multifile) delete [] filecurrent;
|
||||
if (multifile) delete[] filecurrent;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -854,7 +841,7 @@ int Dump::idcompare(const int i, const int j, void *ptr)
|
||||
|
||||
int Dump::bufcompare(const int i, const int j, void *ptr)
|
||||
{
|
||||
Dump *dptr = (Dump *) ptr;
|
||||
auto dptr = (Dump *) ptr;
|
||||
double *bufsort = dptr->bufsort;
|
||||
const int size_one = dptr->size_one;
|
||||
const int sortcolm1 = dptr->sortcolm1;
|
||||
@ -875,7 +862,7 @@ int Dump::bufcompare(const int i, const int j, void *ptr)
|
||||
|
||||
int Dump::bufcompare_reverse(const int i, const int j, void *ptr)
|
||||
{
|
||||
Dump *dptr = (Dump *) ptr;
|
||||
auto dptr = (Dump *) ptr;
|
||||
double *bufsort = dptr->bufsort;
|
||||
const int size_one = dptr->size_one;
|
||||
const int sortcolm1 = dptr->sortcolm1;
|
||||
@ -951,7 +938,7 @@ void Dump::balance()
|
||||
// post recvs first
|
||||
|
||||
int nswap = 0;
|
||||
MPI_Request *request = new MPI_Request[nprocs];
|
||||
auto request = new MPI_Request[nprocs];
|
||||
|
||||
// find which proc starting atom belongs to
|
||||
|
||||
@ -1032,7 +1019,7 @@ void Dump::balance()
|
||||
memory->destroy(tmp);
|
||||
memory->destroy(proc_offsets);
|
||||
memory->destroy(proc_new_offsets);
|
||||
delete [] request;
|
||||
delete[] request;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -1072,7 +1059,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
if (strcmp(id,output->dump[idump]->id) == 0) break;
|
||||
int n;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
delete [] output->var_dump[idump];
|
||||
delete[] output->var_dump[idump];
|
||||
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
|
||||
n = 0;
|
||||
} else {
|
||||
@ -1090,7 +1077,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
if (strcmp(id,output->dump[idump]->id) == 0) break;
|
||||
double delta;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
delete [] output->var_dump[idump];
|
||||
delete[] output->var_dump[idump];
|
||||
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
|
||||
delta = 0.0;
|
||||
} else {
|
||||
@ -1120,7 +1107,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
MPI_Comm_free(&clustercomm);
|
||||
MPI_Comm_split(world,icluster,0,&clustercomm);
|
||||
|
||||
delete [] multiname;
|
||||
delete[] multiname;
|
||||
char *ptr = strchr(filename,'%');
|
||||
*ptr = '\0';
|
||||
multiname = utils::strdup(fmt::format("{}{}{}", filename, icluster, ptr+1));
|
||||
@ -1137,14 +1124,38 @@ void Dump::modify_params(int narg, char **arg)
|
||||
flush_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"colname") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"default") == 0) {
|
||||
for (auto item : keyword_user) item.clear();
|
||||
iarg += 2;
|
||||
} else {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
int icol = -1;
|
||||
if (utils::is_integer(arg[iarg + 1])) {
|
||||
icol = utils::inumeric(FLERR,arg[iarg + 1],false,lmp);
|
||||
if (icol < 0) icol = keyword_user.size() + icol + 1;
|
||||
icol--;
|
||||
} else {
|
||||
try {
|
||||
icol = key2col.at(arg[iarg + 1]);
|
||||
} catch (std::out_of_range &) {
|
||||
icol = -1;
|
||||
}
|
||||
}
|
||||
if ((icol < 0) || (icol >= (int)keyword_user.size()))
|
||||
error->all(FLERR, "Illegal thermo_modify command");
|
||||
keyword_user[icol] = arg[iarg+2];
|
||||
iarg += 3;
|
||||
}
|
||||
} else if (strcmp(arg[iarg],"format") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
|
||||
if (strcmp(arg[iarg+1],"none") == 0) {
|
||||
delete [] format_line_user;
|
||||
delete [] format_int_user;
|
||||
delete [] format_bigint_user;
|
||||
delete [] format_float_user;
|
||||
delete[] format_line_user;
|
||||
delete[] format_int_user;
|
||||
delete[] format_bigint_user;
|
||||
delete[] format_float_user;
|
||||
format_line_user = nullptr;
|
||||
format_int_user = nullptr;
|
||||
format_bigint_user = nullptr;
|
||||
@ -1159,7 +1170,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
|
||||
if (strcmp(arg[iarg+1],"line") == 0) {
|
||||
delete [] format_line_user;
|
||||
delete[] format_line_user;
|
||||
format_line_user = utils::strdup(arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else { // pass other format options to child classes
|
||||
@ -1217,7 +1228,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
MPI_Comm_free(&clustercomm);
|
||||
MPI_Comm_split(world,icluster,0,&clustercomm);
|
||||
|
||||
delete [] multiname;
|
||||
delete[] multiname;
|
||||
char *ptr = strchr(filename,'%');
|
||||
*ptr = '\0';
|
||||
multiname = utils::strdup(fmt::format("{}{}{}", filename, icluster, ptr+1));
|
||||
|
||||
Reference in New Issue
Block a user