Skip to content

Commit

Permalink
implement BoxCell::remove()
Browse files Browse the repository at this point in the history
  • Loading branch information
gentryx committed Aug 15, 2016
1 parent af82749 commit 165848e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/storage/boxcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class BoxCell
particles << particle;
}

inline void remove(const std::size_t i)
{
particles.remove(i);
}

inline std::size_t size() const
{
return particles.size();
Expand Down
15 changes: 15 additions & 0 deletions src/storage/test/unit/boxcelltest.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,21 @@ class BoxCellTest : public CxxTest::TestSuite
}
}

void testRemove()
{
typedef BoxCell<FixedArray<SpawningParticle, 222> > CellType;

FloatCoord<3> origin(3.0, 3.0, 3.0);
FloatCoord<3> cellDim(2.0, 2.0, 2.0);

CellType cell(origin, cellDim);
cell.insert(SpawningParticle(FloatCoord<3>(3.5, 3.5, 3.5), 100));

TS_ASSERT_EQUALS(cell.size(), 1);
cell.remove(0);
TS_ASSERT_EQUALS(cell.size(), 0);
}

private:
Coord<2> gridDim;
FloatCoord<2> cellDim;
Expand Down

0 comments on commit 165848e

Please sign in to comment.