T2345: Replace instances of NULL with nullptr
The following changes have been applied to src and lib folders: regex replace: ([^"_])NULL ⇒ \1nullptr (8968 chgs in src, 1153 in lib) Manually find/change: (void \*) nullptr ⇒ nullptr (1 case) regex find: ".*?nullptr.*?" Manually ~14 cases back to "NULL" in src, ~2 in lib regex finds a few false positive where nullptr appears between two strings in a function call
This commit is contained in:
@ -82,7 +82,7 @@ void Velocity::command(int narg, char **arg)
|
||||
|
||||
// set defaults
|
||||
|
||||
temperature = NULL;
|
||||
temperature = nullptr;
|
||||
dist_flag = 0;
|
||||
sum_flag = 0;
|
||||
momentum_flag = 1;
|
||||
@ -147,7 +147,7 @@ void Velocity::init_external(const char *extgroup)
|
||||
if (igroup == -1) error->all(FLERR,"Could not find velocity group ID");
|
||||
groupbit = group->bitmask[igroup];
|
||||
|
||||
temperature = NULL;
|
||||
temperature = nullptr;
|
||||
dist_flag = 0;
|
||||
sum_flag = 0;
|
||||
momentum_flag = 1;
|
||||
@ -179,18 +179,18 @@ void Velocity::create(double t_desired, int seed)
|
||||
}
|
||||
}
|
||||
|
||||
// if temperature = NULL or bias_flag set,
|
||||
// if temperature = nullptr or bias_flag set,
|
||||
// create a new ComputeTemp with the velocity group
|
||||
|
||||
int tcreate_flag = 0;
|
||||
Compute *temperature_nobias = NULL;
|
||||
Compute *temperature_nobias = nullptr;
|
||||
|
||||
if (temperature == NULL || bias_flag) {
|
||||
if (temperature == nullptr || bias_flag) {
|
||||
char **arg = new char*[3];
|
||||
arg[0] = (char *) "velocity_temp";
|
||||
arg[1] = group->names[igroup];
|
||||
arg[2] = (char *) "temp";
|
||||
if (temperature == NULL) {
|
||||
if (temperature == nullptr) {
|
||||
temperature = new ComputeTemp(lmp,3,arg);
|
||||
tcreate_flag = 1;
|
||||
} else temperature_nobias = new ComputeTemp(lmp,3,arg);
|
||||
@ -245,7 +245,7 @@ void Velocity::create(double t_desired, int seed)
|
||||
|
||||
int m;
|
||||
double vx,vy,vz,factor;
|
||||
RanPark *random = NULL;
|
||||
RanPark *random = nullptr;
|
||||
|
||||
if (loop_flag == ALL) {
|
||||
|
||||
@ -368,7 +368,7 @@ void Velocity::create(double t_desired, int seed)
|
||||
// no-bias compute calculates temp only for new thermal velocities
|
||||
|
||||
double t;
|
||||
if ((bias_flag == 0) || (temperature_nobias == NULL))
|
||||
if ((bias_flag == 0) || (temperature_nobias == nullptr))
|
||||
t = temperature->compute_scalar();
|
||||
else t = temperature_nobias->compute_scalar();
|
||||
rescale(t,t_desired);
|
||||
@ -417,7 +417,7 @@ void Velocity::set(int /*narg*/, char **arg)
|
||||
// parse 3 args
|
||||
|
||||
xstyle = ystyle = zstyle = CONSTANT;
|
||||
xstr = ystr = zstr = NULL;
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[0],"v_") == arg[0]) {
|
||||
int n = strlen(&arg[0][2]) + 1;
|
||||
@ -501,7 +501,7 @@ void Velocity::set(int /*narg*/, char **arg)
|
||||
|
||||
// allocate vfield array if necessary
|
||||
|
||||
double **vfield = NULL;
|
||||
double **vfield = nullptr;
|
||||
if (varflag == ATOM) memory->create(vfield,atom->nlocal,3,"velocity:vfield");
|
||||
|
||||
// set velocities via constants
|
||||
@ -531,17 +531,17 @@ void Velocity::set(int /*narg*/, char **arg)
|
||||
if (xstyle == EQUAL) vx = input->variable->compute_equal(xvar);
|
||||
else if (xstyle == ATOM) {
|
||||
if (vfield) input->variable->compute_atom(xvar,igroup,&vfield[0][0],3,0);
|
||||
else input->variable->compute_atom(xvar,igroup,NULL,3,0);
|
||||
else input->variable->compute_atom(xvar,igroup,nullptr,3,0);
|
||||
}
|
||||
if (ystyle == EQUAL) vy = input->variable->compute_equal(yvar);
|
||||
else if (ystyle == ATOM) {
|
||||
if (vfield) input->variable->compute_atom(yvar,igroup,&vfield[0][1],3,0);
|
||||
else input->variable->compute_atom(yvar,igroup,NULL,3,0);
|
||||
else input->variable->compute_atom(yvar,igroup,nullptr,3,0);
|
||||
}
|
||||
if (zstyle == EQUAL) vz = input->variable->compute_equal(zvar);
|
||||
else if (zstyle == ATOM) {
|
||||
if (vfield) input->variable->compute_atom(zvar,igroup,&vfield[0][2],3,0);
|
||||
else input->variable->compute_atom(zvar,igroup,NULL,3,0);
|
||||
else input->variable->compute_atom(zvar,igroup,nullptr,3,0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
@ -580,10 +580,10 @@ void Velocity::scale(int /*narg*/, char **arg)
|
||||
{
|
||||
double t_desired = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
|
||||
// if temperature = NULL, create a new ComputeTemp with the velocity group
|
||||
// if temperature = nullptr, create a new ComputeTemp with the velocity group
|
||||
|
||||
int tflag = 0;
|
||||
if (temperature == NULL) {
|
||||
if (temperature == nullptr) {
|
||||
char **arg = new char*[3];
|
||||
arg[0] = (char *) "velocity_temp";
|
||||
arg[1] = group->names[igroup];
|
||||
@ -901,7 +901,7 @@ void Velocity::options(int narg, char **arg)
|
||||
|
||||
// error check
|
||||
|
||||
if (bias_flag && temperature == NULL)
|
||||
if (bias_flag && temperature == nullptr)
|
||||
error->all(FLERR,"Cannot use velocity bias command without temp keyword");
|
||||
if (bias_flag && temperature->tempbias == 0)
|
||||
error->all(FLERR,"Velocity temperature ID does calculate a velocity bias");
|
||||
|
||||
Reference in New Issue
Block a user