Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particle restart logs #1649

Merged
merged 2 commits into from
Sep 4, 2020
Merged

Particle restart logs #1649

merged 2 commits into from
Sep 4, 2020

Conversation

GiudGiud
Copy link
Contributor

I came across an interesting bug while looking at particles vanishing from a PB-FHR geometry.

The write_message routine is called in particle.cpp as : write_message("some string with {}", surface_id).

The intent of this is to have surface_id be recognized as a parameter of the string, and the templated write_message() routine can handle it throught a call to fmt::format
Unfortunately, the routine that ends up being called is write_message("some_string", log_level), so surface_id is not shown on screen.

I can't see an easy fix on the error.cpp side. Excluding "int" as a valid parameter in the template takes a bit of code and will be a bit confusing since it's the most common use case for this template. On the other hand, being able to write_message without specifying a level is also very convenient, so we do want int level=0 as an optional second parameter.
Having the templated write_message have a different name also slightly defeats the purpose.

I fixed the symptoms by adding the level to the problematic write_message logs.
Note: An alternative "symptoms" fix is to make surface id be a int64_t, just like particle ids.

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

Hmmm, I see what you mean. I'm going to go ahead and merge this, but we do need a better solution. Would you mind opening up an issue describing this so we can keep track of it?

@paulromano paulromano merged commit c04b673 into openmc-dev:develop Sep 4, 2020
@GiudGiud
Copy link
Contributor Author

GiudGiud commented Sep 4, 2020

done. Thanks for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants