Skip to content

Conversation

@jmaack24
Copy link
Member

Implementation of EmbreeRunner to utilize Intel's Embree ray tracing library (sold separately...).

@jmaack24 jmaack24 self-assigned this Jan 13, 2026
@jmaack24 jmaack24 linked an issue Jan 13, 2026 that may be closed by this pull request
@jmaack24 jmaack24 marked this pull request as ready for review January 15, 2026 19:40
@jmaack24 jmaack24 requested a review from Copilot January 15, 2026 19:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 67 out of 68 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 126 to 127
// increment position by tiny amount to get off the element if
// tracing to the same element
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Fixed typo: 'increment' should start with capital 'I' to match comment style, and the comment should end with a period.

Suggested change
// increment position by tiny amount to get off the element if
// tracing to the same element
// Increment position by tiny amount to get off the element if
// tracing to the same element.

Copilot uses AI. Check for mistakes.
float (&min_coord_global)[3],
float (&max_coord_global)[3]);

} // namespace embree_helper
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Namespace comment is incorrect. Should be '// namespace SolTrace::EmbreeRunner' to match the actual namespace declaration at line 8.

Suggested change
} // namespace embree_helper
} // namespace SolTrace::EmbreeRunner

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,90 @@
#include "find_element_hit.hpp"
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Incorrect include file name. Should be 'find_element_hit_embree.hpp' instead of 'find_element_hit.hpp'.

Suggested change
#include "find_element_hit.hpp"
#include "find_element_hit_embree.hpp"

Copilot uses AI. Check for mistakes.
Comment on lines 669 to 671
TEST(Aperture, BoundingBox)
{
}
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Empty test case should either be implemented or removed. The test name suggests it should test aperture bounding box functionality but has no implementation.

Copilot uses AI. Check for mistakes.
Comment on lines +124 to +125
assert(is_approx(x_minmax[0], -r, 1e-6));
assert(is_approx(x_minmax[1], r, 1e-6));
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Using assert for input validation in production code. Consider using a proper error handling mechanism or documenting that these are debug-only checks. Asserts are typically disabled in release builds.

Suggested change
assert(is_approx(x_minmax[0], -r, 1e-6));
assert(is_approx(x_minmax[1], r, 1e-6));
if (!is_approx(x_minmax[0], -r, 1e-6))
throw std::invalid_argument("Cylinder::bounding_box: x_minmax[0] must be approximately -radius");
if (!is_approx(x_minmax[1], r, 1e-6))
throw std::invalid_argument("Cylinder::bounding_box: x_minmax[1] must be approximately +radius");

Copilot uses AI. Check for mistakes.
EXPECT_NE(rr->get_event(iidx), RayEvent::ABSORB);
EXPECT_NE(rr->get_event(iidx), RayEvent::EXIT);

if(rr->get_event(iidx) == RayEvent::ABSORB)
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Missing space after 'if' keyword. Should be 'if (rr->get_event(iidx) == RayEvent::ABSORB)'.

Copilot uses AI. Check for mistakes.
this->number_of_elements += el->get_number_of_elements();
el->set_reference_element(this);
// Mark any added elements as virtual if needed
if(this->is_virtual())
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Missing space after 'if' keyword. Should be 'if (this->is_virtual())'.

Suggested change
if(this->is_virtual())
if (this->is_virtual())

Copilot uses AI. Check for mistakes.
Comment on lines 249 to 251
// TODO: Fix ? This is really only the top half of the cylinder
// Clyinder breaks the model since it is a mulit-valued fuction: each
// x values produces two z values Returning only the positive root
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Multiple spelling errors: 'Clyinder' should be 'Cylinder', 'mulit-valued fuction' should be 'multi-valued function', and missing period after 'root'.

Suggested change
// TODO: Fix ? This is really only the top half of the cylinder
// Clyinder breaks the model since it is a mulit-valued fuction: each
// x values produces two z values Returning only the positive root
// TODO: Fix ? This is really only the top half of the cylinder.
// Cylinder breaks the model since it is a multi-valued function: each
// x value produces two z values. Returning only the positive root.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 67 out of 68 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 70 out of 71 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Steps for Building SolTrace (work in progress)
SolTrace has been updated to use multiple ray tracing engines in addition to the prior implementation. Currently, there is no graphical user interface (it is underdevelopment).
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The phrase "it is underdevelopment" should be "it is under development" (missing space).

Suggested change
SolTrace has been updated to use multiple ray tracing engines in addition to the prior implementation. Currently, there is no graphical user interface (it is underdevelopment).
SolTrace has been updated to use multiple ray tracing engines in addition to the prior implementation. Currently, there is no graphical user interface (it is under development).

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +130
// Increment position by tiny amount to get off the element if
// tracing to the same element.
PosRayElement[0] = PosRayElement[0] + 1.0e-4 * CosRayElement[0];
PosRayElement[1] = PosRayElement[1] + 1.0e-4 * CosRayElement[1];
PosRayElement[2] = PosRayElement[2] + 1.0e-4 * CosRayElement[2];
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

In the comment on line 126, "Increment position by tiny amount to get off the element" - this hardcoded offset of 1.0e-4 could cause issues with very small or very large geometries. Consider making this epsilon value scale-dependent or configurable based on the element's characteristic dimensions.

Copilot uses AI. Check for mistakes.
Comment on lines +252 to +253
// TODO: Fix ? This is really only the top half of the cylinder.
// Cylinder breaks the model since it is a multi-valued function: each
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The typo "Clyinder" should be "Cylinder" in the comment.

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +99
- name: Install embree (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$embreeVersion = "4.4.0"
$embreeUrl = "https://github.com/embree/embree/releases/download/v$embreeVersion/embree-$embreeVersion.x64.windows.zip"
$embreeZip = "$env:TEMP\embree.zip"
$embreeDir = "C:\embree"
Write-Host "Downloading Embree $embreeVersion..."
Invoke-WebRequest -Uri $embreeUrl -OutFile $embreeZip
Write-Host "Extracting Embree..."
Expand-Archive -Path $embreeZip -DestinationPath $embreeDir -Force
# $embreeRoot = Get-ChildItem -Path $embreeDir -Directory -Filter "embree*" | Select-Object -First 1
$embreeCMake = Join-Path $embreeDir "lib\cmake\embree-$embreeVersion"
$embreeLib = Join-Path $embreeDir "bin"
# Write-Host "Embree root: $($embreeRoot.FullName)"
Write-Host "Embree CMake: $embreeCMake"
Write-Host "Embree Lib: $embreeLib"
echo "embree_DIR=$embreeCMake" >> $env:GITHUB_ENV
echo "$embreeLib" >> $env:GITHUB_PATH
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The Windows Embree installation script extracts to a directory path that includes the version number in the zip, but the code assumes a specific directory structure. The commented-out lines suggest there was an attempt to find the embree directory dynamically. This could break if Embree's directory structure changes between versions. Consider making the path detection more robust.

Copilot uses AI. Check for mistakes.
Comment on lines +353 to +360
// Expand bounding boxes slightly to account for float precision
const float expand = 1e-3f;
x_minmax[0] -= expand;
x_minmax[1] += expand;
y_minmax[0] -= expand;
y_minmax[1] += expand;
z_minmax[0] -= expand;
z_minmax[1] += expand;
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The bounding box expansion with a hardcoded value of 1e-3f could be problematic for different scales. For very small geometries this could be too large, and for very large geometries it might not be sufficient. Consider making this relative to the bounding box dimensions or element scale.

Copilot uses AI. Check for mistakes.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 21261701695

Details

  • 1022 of 1268 (80.6%) changed or added relevant lines in 23 files are covered.
  • 14 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.2%) to 88.052%

Changes Missing Coverage Covered Lines Changed/Added Lines %
coretrace/simulation_runner/native_runner/thread_manager.cpp 2 3 66.67%
coretrace/simulation_runner/native_runner/trace.cpp 8 9 88.89%
coretrace/simulation_data/surface.hpp 21 23 91.3%
coretrace/simulation_runner/native_runner/native_runner.cpp 16 18 88.89%
coretrace/simulation_runner/native_runner/sun_to_primary_stage.cpp 0 2 0.0%
coretrace/simulation_data/aperture.hpp 0 3 0.0%
coretrace/simulation_runner/embree_runner/embree_runner.cpp 36 40 90.0%
coretrace/simulation_data/utilities.hpp 7 12 58.33%
coretrace/simulation_data/surface.cpp 142 148 95.95%
coretrace/simulation_runner/native_runner/determine_interaction_type.cpp 17 26 65.38%
Files with Coverage Reduction New Missed Lines %
coretrace/simulation_data/aperture.hpp 1 74.19%
coretrace/simulation_runner/native_runner/native_runner.cpp 1 92.17%
coretrace/simulation_runner/native_runner/sphere_calculator.hpp 1 0.0%
coretrace/simulation_runner/native_runner/surface_intersection_calculator.hpp 1 50.0%
coretrace/simulation_runner/native_runner/trace.cpp 1 95.0%
coretrace/simulation_data/aperture.cpp 3 69.32%
coretrace/simulation_runner/native_runner/native_runner_types.cpp 6 93.84%
Totals Coverage Status
Change from base Build 21258149251: 0.2%
Covered Lines: 6721
Relevant Lines: 7633

💛 - Coveralls

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Embree Runner

3 participants