Skip to content

Commit

Permalink
Fix a second place where particles compute the size of a buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Mar 29, 2024
1 parent 802318d commit 21bb4a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions include/deal.II/particles/particle_accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,9 @@ namespace Particles
{
Assert(state() == IteratorState::valid, ExcInternalError());

std::size_t size = sizeof(get_id()) + sizeof(get_location()) +
sizeof(get_reference_location());
std::size_t size = sizeof(get_id()) +
sizeof(double) * spacedim + // get_location()
sizeof(double) * dim; // get_reference_location()

if (has_properties())
{
Expand Down
12 changes: 11 additions & 1 deletion source/particles/particle_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,17 @@ namespace Particles
&(*data_range.begin()) + (data_range.end() - data_range.begin()));

while (data < end)
insert_particle(data, cell_to_store_particles);
{
const void *old_data = data;
const auto x = insert_particle(data, cell_to_store_particles);

// Ensure that
const void *new_data = data;
(void)old_data;
(void)new_data;
AssertDimension((const char *)new_data - (const char *)old_data,
x->serialized_size_in_bytes());
}

Assert(data == end,
ExcMessage(
Expand Down

0 comments on commit 21bb4a2

Please sign in to comment.