mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-25 12:35:29 -04:00
added seeds to the plotting model namespace so that if multiple plots are called, they will have different colors
This commit is contained in:
parent
cdcb23796b
commit
44ba6805dc
2 changed files with 12 additions and 9 deletions
16
src/plot.cpp
16
src/plot.cpp
|
|
@ -80,6 +80,8 @@ namespace model {
|
|||
|
||||
std::vector<Plot> plots;
|
||||
std::unordered_map<int, int> plot_map;
|
||||
uint64_t plotter_prn_seeds[N_STREAMS] = {1, 2, 3, 4, 5, 6};
|
||||
int plotter_stream = STREAM_TRACKING;
|
||||
|
||||
} // namespace model
|
||||
|
||||
|
|
@ -396,15 +398,11 @@ Plot::set_default_colors(pugi::xml_node plot_node)
|
|||
fatal_error(err_msg);
|
||||
}
|
||||
|
||||
// Initialize a random number stream
|
||||
uint64_t prn_seed = 1;
|
||||
int stream = 0;
|
||||
|
||||
for (auto& c : colors_) {
|
||||
c = random_color(&prn_seed, stream);
|
||||
c = random_color();
|
||||
// make sure we don't interfere with some default colors
|
||||
while (c == RED || c == WHITE) {
|
||||
c = random_color(&prn_seed, stream);
|
||||
c = random_color();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -962,8 +960,10 @@ voxel_finalize(hid_t dspace, hid_t dset, hid_t memspace)
|
|||
H5Sclose(memspace);
|
||||
}
|
||||
|
||||
RGBColor random_color(uint64_t * prn_seeds, int stream) {
|
||||
return {int(prn(prn_seeds, stream)*255), int(prn(prn_seeds, stream)*255), int(prn(prn_seeds, stream)*255)};
|
||||
RGBColor random_color(void) {
|
||||
return {int(prn(model::plotter_prn_seeds, model::plotter_stream)*255),
|
||||
int(prn(model::plotter_prn_seeds, model::plotter_stream)*255),
|
||||
int(prn(model::plotter_prn_seeds, model::plotter_stream)*255)};
|
||||
}
|
||||
|
||||
extern "C" int openmc_id_map(const void* plot, int32_t* data_out)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue