-
Notifications
You must be signed in to change notification settings - Fork 500
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
Adding atomic mass management in C++ API #2819
base: develop
Are you sure you want to change the base?
Conversation
I understand this is not yet ready. |
I have tested this locally, it seems to be working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice simple code! Here are a few minor suggestions.
src/atomic_mass_data.cpp
Outdated
return s; | ||
} | ||
|
||
// Read a line from atomic mass data and pull usesull content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Read a line from atomic mass data and pull usesull content | |
// Read a line from atomic mass data and pull useful content |
auto pos = atomic_mass_data.find(nuclide); | ||
|
||
if (pos == atomic_mass_data.end()) { | ||
throw std::out_of_range( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the general paradigm in OpenMC now is to call fatal_error
rather than throw exceptions but I'll let someone else weigh in.
auto pos = atomic_mass_data.find(nuclide); | ||
|
||
if (pos == atomic_mass_data.end()) { | ||
throw std::out_of_range( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw std::out_of_range( | |
fatal_error( |
Not sure what is preferred, but this way it is an easy switch.
thx for the review @gridley, much appreciated. I think I have addressed most/all you comments :) |
now it is failing where I expect it to, I need access to the |
Not sure either but perhaps the values from the txt file can just be in the same cpp file that needs the data? |
the file exist in the Python API, I am wondering if there is a place where it can live and both API could access it |
The problem is I don't know what is best:
if we decide to do an include file, shall we add a script to generate it ? generate it on build ? @paulromano @pshriwise do you have any opinion about this ? |
Hi Baptiste, I think it would be ideal for both of these files, atomic masses and atomic abundances to be in external files that are linked in. So there are defaults, but the user can select to read-in a user selected database. |
The need for this PR and following PR #2105 appear again in my new job. It would be great to have a materials collection like PNNL in openmc as it appears to be a common need across a few different organisation that I've seen using using openmc |
Description
This adds a simple API to read store and access, atomic masses.
This is merrily a transposition of the existing version in the Python API.
see data.py
This should be a step toward resolving of #2756.
I still have few questions:
Checklist
This work is sponsored by First Light Fusion.