Fixing group mask bug in gran wall, clean up redundant nullptr assignments
This commit is contained in:
@ -52,7 +52,7 @@ enum {NONE,CONSTANT,EQUAL};
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg), idregion(nullptr), history_one(nullptr),
|
||||
Fix(lmp, narg, arg), idregion(nullptr), tstr(nullptr), history_one(nullptr),
|
||||
fix_rigid(nullptr), mass_rigid(nullptr)
|
||||
{
|
||||
if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command");
|
||||
@ -127,9 +127,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// wallstyle args
|
||||
|
||||
idregion = nullptr;
|
||||
tstr = nullptr;
|
||||
|
||||
if (iarg >= narg) error->all(FLERR, "Illegal fix wall/gran command");
|
||||
|
||||
if (strcmp(arg[iarg],"xplane") == 0) {
|
||||
@ -247,13 +244,11 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
||||
// perform initial allocation of atom-based arrays
|
||||
// register with Atom class
|
||||
|
||||
history_one = nullptr;
|
||||
FixWallGran::grow_arrays(atom->nmax);
|
||||
atom->add_callback(Atom::GROW);
|
||||
atom->add_callback(Atom::RESTART);
|
||||
|
||||
nmax = 0;
|
||||
mass_rigid = nullptr;
|
||||
|
||||
// initialize history as if particle is not touching region
|
||||
// history_one will be a null pointer for wallstyle = REGION
|
||||
@ -323,7 +318,6 @@ void FixWallGran::init()
|
||||
|
||||
// check for FixRigid so can extract rigid body masses
|
||||
|
||||
fix_rigid = nullptr;
|
||||
for (i = 0; i < modify->nfix; i++)
|
||||
if (modify->fix[i]->rigid_flag) break;
|
||||
if (i < modify->nfix) fix_rigid = modify->fix[i];
|
||||
@ -452,7 +446,7 @@ void FixWallGran::post_force(int /*vflag*/)
|
||||
}
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if ((!mask[i]) & groupbit) continue;
|
||||
if (!(mask[i] & groupbit)) continue;
|
||||
|
||||
dx = dy = dz = 0.0;
|
||||
|
||||
@ -548,7 +542,10 @@ void FixWallGran::post_force(int /*vflag*/)
|
||||
}
|
||||
}
|
||||
|
||||
void FixWallGran::clear_stored_contacts() {
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixWallGran::clear_stored_contacts()
|
||||
{
|
||||
const int nlocal = atom->nlocal;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
for (int m = 0; m < size_peratom_cols; m++) {
|
||||
|
||||
@ -59,9 +59,6 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) :
|
||||
memory->destroy(history_one);
|
||||
history_one = nullptr;
|
||||
|
||||
ncontact = nullptr;
|
||||
walls = nullptr;
|
||||
history_many = nullptr;
|
||||
FixWallGranRegion::grow_arrays(atom->nmax);
|
||||
|
||||
// initialize shear history as if particle is not touching region
|
||||
@ -193,7 +190,7 @@ void FixWallGranRegion::post_force(int /*vflag*/)
|
||||
}
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
if ((!mask[i]) & groupbit) continue;
|
||||
if (!(mask[i] & groupbit)) continue;
|
||||
if (! region->match(x[i][0], x[i][1], x[i][2])) continue;
|
||||
|
||||
nc = region->surface(x[i][0], x[i][1], x[i][2], radius[i] + model->pulloff_distance(radius[i], 0.0));
|
||||
|
||||
Reference in New Issue
Block a user