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
Feature extra tallies #1071
base: develop
Are you sure you want to change the base?
Feature extra tallies #1071
Conversation
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.
Thanks for adding these @shimwell ! Next we’ll have to add He production.
In addition to the specific requests here, I think there is a lot of unnecessary (or possibly incorrect) whitespace/indentation change.
bool pyne::Tally::is_valid(std::string s) { | ||
|
||
// todo find some fancy c++ way | ||
int num_tallies = sizeof(tally_type_enum2string)/sizeof(tally_type_enum2string[0]); |
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.
I think if you make tally_type_enum2string
a std::vector
of std::string
your life will be easier.
int ent, std::string ent_type, | ||
std::string ent_name, std::string tal_name, | ||
double size, double norm ) { | ||
int ent, std::string ent_type, |
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.
The style guide indicates that indentation should align with the first argument on the previous line.
|
||
} else if (tally_type.find("HEAT") != std::string::npos ) { | ||
output << "F" << tally_index << "6:" << particle_token << " " << entity_id << std::endl; | ||
output << "FM" << tally_index << "6 " << normalization << std::endl; |
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.
Earlier options only normalize if normalization > 1
. Should it be the same here?
if(mat_num == "?" ) { std::cout << "mat_number unset for a need fm card" << std::endl;} | ||
output << "FM" << tally_index << "4 " << " 1 " << mat_num << " 205 " << std::endl; | ||
|
||
} else if (tally_type.find("DPA") != std::string::npos ) { |
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.
Check for neutron here, as with TBR
@@ -49,6 +51,8 @@ namespace pyne | |||
|
|||
~Tally (); /// default destructor | |||
|
|||
// is the proposed name a valid tally name | |||
bool is_valid(std::string s); |
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.
Perhaps is_supported
is a better name... a tally could be theoretically valid and not supported, and a user could use a supported tally, but define it in an invalid way...
} else if (tally_type.find("TBR") != std::string::npos && particle_token == "n" ) { | ||
output << "F" << tally_index << "4:" << particle_token << " " << entity_id << std::endl; | ||
if(mat_num == "?" ) { std::cout << "mat_number unset for a need fm card" << std::endl;} | ||
output << "FM" << tally_index << "4 " << " 1 " << mat_num << " 205 " << std::endl; |
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.
indentation seems off
} else if (tally_type.find("DPA") != std::string::npos ) { | ||
output << "F" << tally_index << "4:" << particle_token << " " << entity_id << std::endl; | ||
if(mat_num == "?" ) { std::cout << "mat_number unset for a need fm card" << std::endl;} | ||
output << "FM" << tally_index << "4 " << " 1 " << mat_num << " 444 " << std::endl; |
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.
same here (indentation)
} else if (tally_type.find("DPA") != std::string::npos ) { | ||
output << "F" << tally_index << "4:" << particle_token << " " << entity_id << std::endl; | ||
if(mat_num == "?" ) { std::cout << "mat_number unset for a need fm card" << std::endl;} | ||
output << "FM" << tally_index << "4 " << " 1 " << mat_num << " 444 " << std::endl; |
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.
maybe there is a way to combine those sections, as the only difference between them is a 444
swapped for a 205
// TODO this could be cleaner | ||
std::string mat_num = "?"; | ||
if ( material ) { | ||
int mat_id = material->metadata["mat_number"].asInt(); |
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.
You probably also need to check if the mat_number
is a valid metadata....
# writes the photon tally to arb file and path | ||
def write_arb_p_heat(file_name,path): | ||
tally = Tally("HEAT","Neutron",12,"Volume","Volume 12","Neutron HEAT in Cell 12",35.0) | ||
tally.write_hdf5(file_name,path) |
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.
this adds method to compute and write the tallies, but I don't see them used in the test.
Are those tests missing ?
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.
@shimwell thx for putting this in.
There is some indentation to fix as well.
I'm not quite sure how to bring the PR back to life as the original source branch appears to have got lost. The PR is reporting an unknown source and I don't appear to have any Branches on my fork of Pyne. |
Created pull request to address this issue / feature request
Extra tallies for TBR, DPA and HEAT have been added to the tally.cpp and associated files