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

Remove use of sscanf for reading surface coefficients #2574

Merged
merged 2 commits into from
Jun 24, 2023

Conversation

paulromano
Copy link
Contributor

Description

Periodically, users have run into issues (e.g., this recent post) where OpenMC produces the following error:

 ERROR: Something went wrong reading coeffs for surface 1

even though their geometry.xml file looks perfectly fine. I believe this is happening for international users who have a locale set such that the sscanf function (which is currently used for this) is sensitive to it. This PR removes the use of sscanf in favor of C++ streams (implemented in get_node_array).

To make sure this doesn't impact read performance on large geometry.xml files, I tested it on my ITER E-lite model (~500k surfaces) and it made no difference in the initialization time.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format on any C++ source files (if applicable)

@gridley
Copy link
Contributor

gridley commented Jun 22, 2023

Hm, while we're here, seems like we should just lump these into one function! Seems like a holdover from the fortran era to have this split into multiple ones. I'll cook up an implementation of this in a bit.

@gridley
Copy link
Contributor

gridley commented Jun 22, 2023

Alright, I just opened a new PR with the variadic version of this. It's up to you whichever way you want merged in the end, Paul!

@paulromano
Copy link
Contributor Author

@gridley Not a huge fan of the primitive va_list approach so I decided to pursue an alternative here using std::initializer_list. Personally I think it's cleaner and requires less mental effort for someone reading the code. Let me know what you think!

@gridley
Copy link
Contributor

gridley commented Jun 22, 2023

Oooo, good way to do it!!

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