Move destruction of splines data structure to FixBocs destructor

from ComputePressure destructor.
This commit is contained in:
Anne Gunn 2020-08-19 05:46:04 -06:00
parent e11a3c4799
commit 9ef725ea52
2 changed files with 10 additions and 4 deletions

View File

@ -115,6 +115,7 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) :
vector = new double[size_vector];
nvirial = 0;
vptr = NULL;
splines = NULL;
spline_length = 0;
}
@ -127,10 +128,6 @@ ComputePressureBocs::~ComputePressureBocs()
delete [] vector;
delete [] vptr;
if (phi_coeff) free(phi_coeff);
// Any splines data that was sent in from fix_bocs must be
// freed here, after it has been used.
memory->destroy(splines);
}
/* ---------------------------------------------------------------------- */

View File

@ -118,6 +118,9 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
p_match_coeffs = NULL;
splines = NULL;
spline_length = 0;
// turn on tilt factor scaling, whenever applicable
dimension = domain->dimension;
@ -476,6 +479,12 @@ FixBocs::~FixBocs()
}
}
if (p_match_coeffs) free(p_match_coeffs);
// Free splines memory structure
if (splines != NULL) {
memory->destroy(splines);
spline_length = 0;
}
}
/* ---------------------------------------------------------------------- */