Skip to content

Commit

Permalink
fixup: frozen/local offsets for neighbors
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Dec 17, 2024
1 parent 391444e commit b10129f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
23 changes: 10 additions & 13 deletions src/CabanaPD_Force.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,24 @@ class Force<MemorySpace, BaseForceModel>
Force( const bool half_neigh, const double delta,
const ParticleType& particles, const double tol = 1e-14 )
: _half_neigh( half_neigh )
// Note: this construction must always include frozen particles as
// potential neighbors, so we start at zero.
, _neigh_list( neighbor_list_type( particles.sliceReferencePosition(),
0, particles.numLocal(), delta + tol,
1.0, particles.ghost_mesh_lo,
particles.ghost_mesh_hi ) )
, _neigh_list( neighbor_list_type(
particles.sliceReferencePosition(), particles.frozenOffset(),
particles.localOffset(), delta + tol, 1.0,
particles.ghost_mesh_lo, particles.ghost_mesh_hi ) )
{
}

// General constructor (necessary for contact, but could be used by any
// force routine).
template <class PositionType>
Force( const bool half_neigh, const double delta,
const PositionType& positions, const std::size_t num_local,
const double mesh_min[3], const double mesh_max[3],
const double tol = 1e-14 )
const PositionType& positions, const std::size_t frozen_offset,
const std::size_t local_offset, const double mesh_min[3],
const double mesh_max[3], const double tol = 1e-14 )
: _half_neigh( half_neigh )
// Note: this construction must always include frozen particles as
// potential neighbors, so we start at zero.
, _neigh_list( neighbor_list_type( positions, 0, num_local, delta + tol,
1.0, mesh_min, mesh_max ) )
, _neigh_list( neighbor_list_type( positions, frozen_offset,
local_offset, delta + tol, 1.0,
mesh_min, mesh_max ) )
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/force/CabanaPD_Force_Contact.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Force<MemorySpace, NormalRepulsionModel>
Force( const bool half_neigh, const ParticleType& particles,
const NormalRepulsionModel model )
: base_type( half_neigh, model.Rc, particles.sliceCurrentPosition(),
particles.localOffset(), particles.ghost_mesh_lo,
particles.ghost_mesh_hi )
particles.frozenOffset(), particles.localOffset(),
particles.ghost_mesh_lo, particles.ghost_mesh_hi )
, _model( model )
{
for ( int d = 0; d < particles.dim; d++ )
Expand Down

0 comments on commit b10129f

Please sign in to comment.