Fix weight modification for uniform source sampling (#3395)

Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
This commit is contained in:
Paul Romano 2025-05-05 15:59:11 -05:00 committed by GitHub
parent dc619eac17
commit e4f55a57b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 34 additions and 23 deletions

View file

@ -620,13 +620,6 @@ void read_settings_xml(pugi::xml_node root)
model::external_sources.push_back(make_unique<FileSource>(path));
}
// Build probability mass function for sampling external sources
vector<double> source_strengths;
for (auto& s : model::external_sources) {
source_strengths.push_back(s->strength());
}
model::external_sources_probability.assign(source_strengths);
// If no source specified, default to isotropic point source at origin with
// Watt spectrum. No default source is needed in random ray mode.
if (model::external_sources.empty() &&
@ -639,6 +632,13 @@ void read_settings_xml(pugi::xml_node root)
UPtrDist {new Discrete(T, p, 1)}));
}
// Build probability mass function for sampling external sources
vector<double> source_strengths;
for (auto& s : model::external_sources) {
source_strengths.push_back(s->strength());
}
model::external_sources_probability.assign(source_strengths);
// Check if we want to write out source
if (check_for_node(root, "write_initial_source")) {
write_initial_source = get_node_value_bool(root, "write_initial_source");