-
Notifications
You must be signed in to change notification settings - Fork 6
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
modified src/mcnp_library.cpp to properly read the directory entries #30
Conversation
According to an MCNP document, https://mcnp.lanl.gov/pdf_files/TechReport_2022_LANL_LA-UR-22-30006Rev.1_KuleszaAdamsEtAl.pdf the lines below "DIRECTORY" (case insensitive) consist of "seven- to eleven-entry description of each table". The present implementation, however, seems to assume eleven entries, and therefore when it encounters a seven-entry line, it coredumps in e.g. trying to convert a string to double in mcnp_library.cpp:191 To properly read these variable-entry-number lines, a modification was made by utilizing std::getline(); the input stream is read line-by-line and then decomposed.
src/mcnp_library.cpp
Outdated
if (str!="+" && line_buffer.size()<=11) // each content if it's not | ||
line_buffer.push_back(str); // the continuation mark | ||
else | ||
goto LINE_LOOP; // goto the continued line |
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.
Would it be possible to remove this goto
? I think a good solution might be to put the 3 lines above into a lambda function, and we can then call that at the beginning of the outer while loop, and in this else statement.
Thank you for your contribution ! I left one comment about changing the Currently, Papillon cannot handle multiple ACE tables being in the same file (as you can see, the |
Hi. Happy new year! Sorry for my late reply; I had to make a trip to a different part of Japan to attend a memorial service and then to do year-end clean-up of my house after coming back home... I've further modified the code to eliminate the It's possible to extract the contents of a directry-entry line by using a regular expression (and I did write the regex e.g. As for the (Sorry for my broken language!) |
Sorry for taking so long to get back to this ! Don't worry about the multiple ACE tables in a file; I will handle this in a separate PR at some point. I made a few small modifications to your branch, but otherwise I think it looks good. Please check to make sure that it still works on your other xsdirs, and if so, I will merge this PR. |
It does NOT work at all; it seems that by doing
and is not always given. Therefore, in case it's not given, the following line,
By the way, the MCNP manual says that the temperature parameter "is used only for neutron data", but |
I modified it now to only read CE neutron data with a c or t suffix. Hopefully this is the last needed fix 🤞🏼. |
I don't think you have tested the modified code by yourself... |
My apologies: I did test it, but I think that there was an older version caught in my |
According to an MCNP document, the lines below "DIRECTORY" (case insensitive) in a "xsdir" file consist of "seven- to eleven-entry description of each table". The present implementation, however, seems to assume that eleven entries always exist, and therefore when it encounters a seven-entry line, it coredumps in e.g. trying to convert a string to double in mcnp_library.cpp:191
To properly read these variable-entry-number lines, a modification was made by utilizing std::getline(); the input stream is read line-by-line and then decomposed.
Tested with
of MCNP6.1 and
of PHITS.