default arguments on polymorph/pure methods can lead to unexpected overloading in derived classes

argument for Integrate::setup() made explicit
This commit is contained in:
Axel Kohlmeyer
2018-02-22 07:53:58 -05:00
parent e1d1c87656
commit cf3887c5e0
14 changed files with 35 additions and 33 deletions

View File

@ -31,7 +31,7 @@ class VerletKokkos : public Verlet {
public:
VerletKokkos(class LAMMPS *, int, char **);
~VerletKokkos() {}
void setup(int flag=1);
void setup(int);
void setup_minimal(int);
void run(int);

View File

@ -293,7 +293,7 @@ void PRD::command(int narg, char **arg)
update->whichflag = 1;
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
if (temp_flag == 0) {
if (universe->iworld == 0) temp_dephase = temperature->compute_scalar();
@ -390,7 +390,7 @@ void PRD::command(int narg, char **arg)
update->whichflag = 1;
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
timer->barrier_start();
@ -545,7 +545,7 @@ void PRD::dynamics(int nsteps, double &time_category)
update->nsteps = nsteps;
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
// this may be needed if don't do full init
//modify->addstep_compute_all(update->ntimestep);
bigint ncalls = neighbor->ncalls;

View File

@ -264,7 +264,7 @@ void TAD::command(int narg, char **arg)
update->whichflag = 1;
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
// main loop: look for events until out of time
// (1) dynamics, store state, quench, check event, restore state
@ -342,7 +342,7 @@ void TAD::command(int narg, char **arg)
update->whichflag = 1;
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
// write restart file of hot coords
@ -448,7 +448,7 @@ void TAD::dynamics()
update->nsteps = t_event;
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
// this may be needed if don't do full init
//modify->addstep_compute_all(update->ntimestep);
int ncalls = neighbor->ncalls;

View File

@ -212,7 +212,7 @@ void Temper::command(int narg, char **arg)
if (me_universe == 0 && universe->uscreen)
fprintf(universe->uscreen,"Setting up tempering ...\n");
update->integrate->setup();
update->integrate->setup(1);
if (me_universe == 0) {
if (universe->uscreen) {

View File

@ -239,13 +239,13 @@ void VerletSplit::init()
servant partition only sets up KSpace calculation
------------------------------------------------------------------------- */
void VerletSplit::setup()
void VerletSplit::setup(int flag)
{
if (comm->me == 0 && screen)
fprintf(screen,"Setting up Verlet/split run ...\n");
if (!master) force->kspace->setup();
else Verlet::setup();
else Verlet::setup(flag);
}
/* ----------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ class VerletSplit : public Verlet {
VerletSplit(class LAMMPS *, int, char **);
~VerletSplit();
void init();
void setup();
void setup(int);
void setup_minimal(int);
void run(int);
bigint memory_usage();

View File

@ -214,7 +214,7 @@ void TemperGrem::command(int narg, char **arg)
if (me_universe == 0 && universe->uscreen)
fprintf(universe->uscreen,"Setting up tempering ...\n");
update->integrate->setup();
update->integrate->setup(1);
if (me_universe == 0) {
if (universe->uscreen) {

View File

@ -190,7 +190,7 @@ void TemperNPT::command(int narg, char **arg)
if (me_universe == 0 && universe->uscreen)
fprintf(universe->uscreen,"Setting up tempering ...\n");
update->integrate->setup();
update->integrate->setup(1);
if (me_universe == 0) {
if (universe->uscreen) {

View File

@ -67,24 +67,26 @@ void RespaOMP::init()
setup before run
------------------------------------------------------------------------- */
void RespaOMP::setup()
void RespaOMP::setup(int flag)
{
if (comm->me == 0 && screen) {
fprintf(screen,"Setting up r-RESPA/omp run ...\n");
fprintf(screen," Unit style : %s\n", update->unit_style);
fprintf(screen," Current step : " BIGINT_FORMAT "\n", update->ntimestep);
fprintf(screen," Time steps :");
for (int ilevel=0; ilevel < nlevels; ++ilevel)
fprintf(screen," %d:%g",ilevel+1, step[ilevel]);
fprintf(screen,"\n r-RESPA fixes :");
for (int l=0; l < modify->n_post_force_respa; ++l) {
Fix *f = modify->fix[modify->list_post_force_respa[l]];
if (f->respa_level >= 0)
fprintf(screen," %d:%s[%s]",
MIN(f->respa_level+1,nlevels),f->style,f->id);
if (flag) {
fprintf(screen," Unit style : %s\n", update->unit_style);
fprintf(screen," Current step : " BIGINT_FORMAT "\n", update->ntimestep);
fprintf(screen," Time steps :");
for (int ilevel=0; ilevel < nlevels; ++ilevel)
fprintf(screen," %d:%g",ilevel+1, step[ilevel]);
fprintf(screen,"\n r-RESPA fixes :");
for (int l=0; l < modify->n_post_force_respa; ++l) {
Fix *f = modify->fix[modify->list_post_force_respa[l]];
if (f->respa_level >= 0)
fprintf(screen," %d:%s[%s]",
MIN(f->respa_level+1,nlevels),f->style,f->id);
}
fprintf(screen,"\n");
timer->print_timeout(screen);
}
fprintf(screen,"\n");
timer->print_timeout(screen);
}
update->setupflag = 1;

View File

@ -30,7 +30,7 @@ class RespaOMP : public Respa, public ThrOMP {
RespaOMP(class LAMMPS *, int, char **);
virtual ~RespaOMP() {}
virtual void init();
virtual void setup();
virtual void setup(int);
virtual void setup_minimal(int);
protected:

View File

@ -23,7 +23,7 @@ class Integrate : protected Pointers {
Integrate(class LAMMPS *, int, char **);
virtual ~Integrate();
virtual void init();
virtual void setup(int flag=1) = 0;
virtual void setup(int flag) = 0;
virtual void setup_minimal(int) = 0;
virtual void run(int) = 0;
virtual void cleanup() {}

View File

@ -48,7 +48,7 @@ class Respa : public Integrate {
Respa(class LAMMPS *, int, char **);
virtual ~Respa();
virtual void init();
virtual void setup(int flag=1);
virtual void setup(int);
virtual void setup_minimal(int);
virtual void run(int);
virtual void cleanup();

View File

@ -175,7 +175,7 @@ void Run::command(int narg, char **arg)
if (preflag || update->first_update == 0) {
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
} else output->setup(0);
timer->init();
@ -216,7 +216,7 @@ void Run::command(int narg, char **arg)
if (preflag || iter == 0) {
lmp->init();
update->integrate->setup();
update->integrate->setup(1);
} else output->setup(0);
timer->init();

View File

@ -29,7 +29,7 @@ class Verlet : public Integrate {
Verlet(class LAMMPS *, int, char **);
virtual ~Verlet() {}
virtual void init();
virtual void setup(int flag=1);
virtual void setup(int flag);
virtual void setup_minimal(int);
virtual void run(int);
void cleanup();