Fixed initialization of arrays in fixes

This commit is contained in:
Anders Hafreager 2016-08-25 11:33:10 +02:00 committed by Axel Kohlmeyer
parent ee2f6ded29
commit 2c7241bfe2
4 changed files with 13 additions and 12 deletions

View File

@ -33,7 +33,8 @@ enum{COMPUTE,FIX,VARIABLE};
/* ---------------------------------------------------------------------- */
FixController::FixController(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
pvID(NULL), cvID(NULL)
{
if (narg != 11) error->all(FLERR,"Illegal fix controller command");
@ -50,8 +51,6 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) :
ki = force->numeric(FLERR,arg[6]);
kd = force->numeric(FLERR,arg[7]);
pvID = cvID = NULL;
// process variable arg
int iarg = 8;

View File

@ -46,7 +46,8 @@ enum{NO_REMAP,X_REMAP,V_REMAP};
/* ---------------------------------------------------------------------- */
FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
rfix(NULL), irregular(NULL), set(NULL)
{
if (narg < 4) error->all(FLERR,"Illegal fix deform command");
@ -355,7 +356,6 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
next_reneighbor = -1;
nrigid = 0;
rfix = NULL;
flip = 0;
if (force_reneighbor) irregular = new Irregular(lmp);
@ -368,9 +368,11 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
FixDeform::~FixDeform()
{
for (int i = 0; i < 6; i++) {
delete [] set[i].hstr;
delete [] set[i].hratestr;
if(set) {
for (int i = 0; i < 6; i++) {
delete [] set[i].hstr;
delete [] set[i].hratestr;
}
}
delete [] set;
delete [] rfix;

View File

@ -26,12 +26,12 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
flist(NULL)
{
if (narg != 3) error->all(FLERR,"Illegal fix enforce2d command");
nfixlist = 0;
flist = NULL;
}
/* ---------------------------------------------------------------------- */

View File

@ -29,7 +29,8 @@ enum{PF_CALLBACK,PF_ARRAY};
/* ---------------------------------------------------------------------- */
FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
fexternal(NULL)
{
if (narg < 4) error->all(FLERR,"Illegal fix external command");
@ -56,7 +57,6 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) :
// perform initial allocation of atom-based array
// register with Atom class
fexternal = NULL;
grow_arrays(atom->nmax);
atom->add_callback(0);