External sources alias sampler (#3201)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Ebny Walid Ahammed 2024-11-23 13:10:39 -06:00 committed by GitHub
parent dd01c40ae1
commit 2d988a69a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 16 deletions

View file

@ -563,6 +563,13 @@ 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() &&