Skip to content

Element groups#139

Open
nickmedwards wants to merge 24 commits into
NLR-SolTrace:developfrom
nickmedwards:element_groups
Open

Element groups#139
nickmedwards wants to merge 24 commits into
NLR-SolTrace:developfrom
nickmedwards:element_groups

Conversation

@nickmedwards
Copy link
Copy Markdown

  1. sorry about the vscode settings, the .gitignore didn't ignore it
  2. added --level and --verbose to simdriver\main.cpp. for main, --level changes the file printing behavior. i haven't actually implemented --verbose yet
  3. added group to elements to programmatically track groups of elements. i tried to make this backwards compatible, so simulations without groups wouldn't need to be changed. currently groups must be added through the JSON file, after all ungrouped elements, in order from 0 to the number of groups (see file_io_test.cpp for the tests i wrote regarding this).
  4. let me know if i am handling user input errors correctly in simulation_data.cpp. how should i get the system to fail gracefully from the users perspective?
  5. default group for single elements is -1 (ie ungrouped) set in single_element.cpp, composite/stage/etc elements are given -2 because they don't interact with the trace
  6. created struct SolTrace::Result::GroupResult to hold the counts for a given group. right now it just has basic counts (ie absorbs/reflects), but i will write a function for comparing GroupResult structs to get stuff like efficiencies.
  7. added a vector of GroupResults to SimulationResult and created SimulationResult::write_json_file to write those structs to a json file
  8. i think that it would be potentially useful to used group information in the trace itself, so i added the groups to OptixCSP::SolTraceSystem, for the other runners, add the groups to TSystem for what i think would be a similar level of access.
  9. added enum SolTrace::Runner::RunnerStatistics to toggle between different reporting behavior, ie does runner.report_simulation(&result, level) return the ray record data, the group results, or both?
  10. created some tests to cover my bases, all are in \unit-tests, added some json files for testing file io behavior

@nickmedwards nickmedwards marked this pull request as ready for review May 13, 2026 15:05
Copy link
Copy Markdown
Collaborator

@jmaack24 jmaack24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this feature. I think forcing a group to be an interval of element ids is too rigid though. It would make grouping difficult to use in a python script and nearly impossible to use with the GUI.

There is also no implementation done for the NativeRunner or EmbreeRunner. At a minimum, there should be some sort of error printed or thrown for those two runners that say this feature has not been implemented. From the user survey results, I expect these are going to be the most commonly used runners by users.

Comment thread .vscode/settings.json Outdated
Comment thread coretrace/simulation_data/composite_element.hpp Outdated
Comment thread coretrace/simulation_data/element.cpp Outdated
Comment thread coretrace/simulation_data/element.cpp Outdated
Comment thread coretrace/simulation_data/element.hpp Outdated
return static_cast<double>(sqrtf(cross.x * cross.x + cross.y * cross.y + cross.z * cross.z));
}

int8_t SolTraceSystem::get_group(int32_t element_id) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should live in OptixRunner rather than here. See comment on line 109 of soltrace_system.h

Again, I think we need a grouping implementation that is more flexible.


# Conditionally link OptiX runner
if(SOLTRACE_BUILD_OPTIX_SUPPORT)
list(APPEND RES_LIBS optix_runner)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimulationResult unit tests shouldn't need a runner.

They should be pretty simple tests which check that a particular function works. The idea is to make sure the function does what it "promises" to do while also making you think about whether you've handled the possible error conditions. See the other SimulationResult, SimulationData or even many of the NativeRunner unit tests. Do NOT use the CST unit tests as an example (most of those are examples of what NOT to do).

If you absolutely have to use a runner, it should be the NativeRunner so these tests can run on any platform.

params.max_number_of_rays = params.number_of_rays * 100;
params.seed = 608;

OptixRunner runner;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail to compile if we are building without optix support.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test feels much more like a test that should be in the OptixRunner unit test group.

Comment thread google-tests/unit-tests/simulation_runner/optix_runner/two_plate_test.cpp Outdated
@taylorbrown75
Copy link
Copy Markdown
Collaborator

taylorbrown75 commented May 13, 2026

Should we change the JSON schema with this pull request? That process is not defined, but it seems like adding json variables would be a good time to increment it. @jmaack24

@jmaack24
Copy link
Copy Markdown
Collaborator

Should we change the JSON schema with this pull request? That process is not defined, but it seems like adding json variables would be a good time to increment it. @jmaack24

We probably should come up with a process for changing the JSON schema or some sort of versioning for it. What were you thinking of adding?

@taylorbrown75
Copy link
Copy Markdown
Collaborator

Should we change the JSON schema with this pull request? That process is not defined, but it seems like adding json variables would be a good time to increment it. @jmaack24

We probably should come up with a process for changing the JSON schema or some sort of versioning for it. What were you thinking of adding?

I don't have a plan in mind. I'll add a note so we remember to discuss it at the next meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants