Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/openmc/shared_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ class SharedArray {
//! \param size The new size of the container
void resize(int64_t size) { size_ = size; }

//! Return whether the array is full
bool full()
{
return size_ == capacity_;
}

//! Return the number of elements that the container has currently allocated
//! space for.
int64_t capacity() { return capacity_; }
Expand Down
3 changes: 2 additions & 1 deletion src/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ void Particle::cross_surface()
write_message(1, " Crossing surface {}", surf->id_);
}

if (surf->surf_source_ && simulation::current_batch > settings::n_inactive) {
if (surf->surf_source_ && simulation::current_batch > settings::n_inactive &&
!simulation::surf_source_bank.full()) {
SourceSite site;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we had Particle::to_source_site, since this pattern is probably used elsewhere. Again, not necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion! I'll look into doing this on a separate PR

site.r = r();
site.u = u();
Expand Down
Binary file modified tests/regression_tests/surface_source/surface_source_true.h5
Binary file not shown.