-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support surface-based VecGeom 2.x navigator #1422
Draft
mrguilima
wants to merge
36
commits into
celeritas-project:develop
Choose a base branch
from
mrguilima:vg-2.x
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
2cb9b11
Adapt to VG 2.x templated ABBoxManager
mrguilima ef6eec4
Updates to use the latest BVHSurfNavigator from VecGeom 2.x
mrguilima 6fa1b18
Temporary fix to four-levels.gdml: replace unsupported orb with suppo…
mrguilima 228ed58
Fixes to Vecgeom:FourLevelsTest*
mrguilima 9956e5d
Revert "Fixes to Vecgeom:FourLevelsTest*"
sethrj 5265793
Add orb->sphere translation and disable unimplemented surface solids
sethrj 0c943b7
Add surface geometry to CI
sethrj f272247
Merge remote-tracking branch 'upstream/develop' into vg-2.x
sethrj 94eba34
REVERTME: delete other CI builds
sethrj 97be3f7
Fix infinite loop in field propagator due to misbehaving boundary
sethrj 162bfa2
Simplify initializer
sethrj f4ce1c8
Add two-boxes test and re-enable other vecgeom tests
sethrj 6d7acf4
Fix distance-to-boundary by initializing hit surface to -1
sethrj 161823a
Fix SurfNavigator for TwoBoxes*: new field, VecgeomTrackView::hit_surf_
mrguilima 8682d4b
Merge remote-tracking branch 'upstream/develop' into vg-2.x
sethrj a64570c
Revert orb-to-sphere conversion after vecgeom#1231
sethrj 88e4716
Always save cache if build succeeds
sethrj a0f38b2
fixup! Always save cache if build succeeds
sethrj f9d8fb0
New reference values for CmseTest.trace
mrguilima f29529d
Always reset hit_surf before calling finding next step
mrguilima 69a1de2
No more warnings during loading of four-levels geometry
mrguilima f75b87b
No more warnings during loading of Cmse.gdml
mrguilima 976089d
Add CELERITAS_VECGEOM_SURFACE macro
sethrj 3b0385b
Make next surface persistent
sethrj e45bc55
Loosen move-internal requirement for VecGeom
sethrj 137ae12
Remove warning expectation from vecgeom 2
sethrj 4eeed43
Fix build
sethrj a107ae9
Disabled two tests doing tracking outside of world
mrguilima b9cbe7f
GL temp: missing code
mrguilima 9426140
Merge branch 'develop' into vg-2.x
mrguilima a85bc2f
Disable tests related to navigation from the outside
mrguilima 39941c0
Fixes for VecGeom v2.x
mrguilima 970100b
Switch test expected value depending on VecGeom version
mrguilima 7f9b580
More temporary fixes to Vecgeom tests
mrguilima ce5ec00
Merge branch 'develop' into vg-2.x
mrguilima b7a5aaa
Merge branch 'develop' into vg-2.x
mrguilima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,8 @@ | |
#include <VecGeom/base/Config.h> | ||
#include <VecGeom/base/Global.h> | ||
#include <VecGeom/base/Vector3D.h> | ||
#include <VecGeom/navigation/NavStateIndex.h> | ||
#include <VecGeom/surfaces/Navigator.h> | ||
#include <VecGeom/navigation/NavigationState.h> | ||
#include <VecGeom/surfaces/BVHSurfNavigator.h> | ||
|
||
#ifdef VECGEOM_ENABLE_CUDA | ||
# include <VecGeom/backend/cuda/Interface.h> | ||
|
@@ -32,29 +32,39 @@ class SurfNavigator | |
public: | ||
using Precision = vecgeom::Precision; | ||
using Vector3D = vecgeom::Vector3D<vecgeom::Precision>; | ||
using VPlacedVolumePtr_t = vecgeom::VPlacedVolume const*; | ||
using SurfData = vgbrep::SurfData<Precision>; | ||
using Real_b = typename SurfData::Real_b; | ||
using VPlacedVolumePtr_t = vecgeom::VPlacedVolume const*; | ||
|
||
static constexpr Precision kBoundaryPush = 10 * vecgeom::kTolerance; | ||
|
||
// Locates the point in the geometry volume tree | ||
CELER_FUNCTION static VPlacedVolumePtr_t | ||
LocatePointIn(VPlacedVolumePtr_t vol, | ||
/// @brief Locates the point in the geometry volume tree | ||
/// @param pvol_id Placed volume id to be checked first | ||
/// @param point Point to be checked, in the local frame of pvol | ||
/// @param path Path to a parent of pvol that must contain the point | ||
/// @param top Check first if pvol contains the point | ||
/// @param exclude Placed volume id to exclude from the search | ||
/// @return Index of the placed volume that contains the point | ||
CELER_FUNCTION static int | ||
LocatePointIn(int pvol_id, | ||
Vector3D const& point, | ||
vecgeom::NavStateIndex& path, | ||
bool top) | ||
vecgeom::NavigationState& path, | ||
bool top, | ||
int *exclude = nullptr) | ||
{ | ||
return vgbrep::protonav::LocatePointIn(vol, point, path, top); | ||
return vgbrep::protonav::BVHSurfNavigator<Precision>::LocatePointIn(pvol_id, point, path, top, exclude); | ||
} | ||
|
||
// Computes the isotropic safety from the globalpoint. | ||
/// @brief Computes the isotropic safety from the globalpoint. | ||
/// @param globalpoint Point in global coordinates | ||
/// @param state Path where to compute safety | ||
/// @return Isotropic safe distance | ||
CELER_FUNCTION static Precision | ||
ComputeSafety(Vector3D const& globalpoint, | ||
vecgeom::NavStateIndex const& state) | ||
vecgeom::NavigationState const& state) | ||
{ | ||
int closest_surf = 0; | ||
return vgbrep::protonav::ComputeSafety( | ||
globalpoint, state, closest_surf); | ||
auto safety = vgbrep::protonav::BVHSurfNavigator<Precision>::ComputeSafety(globalpoint, state); | ||
return safety; | ||
} | ||
|
||
// Computes a step from the globalpoint (which must be in the current | ||
|
@@ -68,9 +78,8 @@ class SurfNavigator | |
ComputeStepAndNextVolume(Vector3D const& globalpoint, | ||
Vector3D const& globaldir, | ||
Precision step_limit, | ||
vecgeom::NavStateIndex const& in_state, | ||
vecgeom::NavStateIndex& out_state, | ||
[[maybe_unused]] Precision push = 0) | ||
vecgeom::NavigationState const& in_state, | ||
vecgeom::NavigationState& out_state) | ||
{ | ||
if (step_limit <= 0) | ||
{ | ||
|
@@ -79,9 +88,9 @@ class SurfNavigator | |
return step_limit; | ||
} | ||
|
||
int exit_surf = 0; | ||
auto step = vgbrep::protonav::ComputeStepAndHit( | ||
globalpoint, globaldir, in_state, out_state, exit_surf, step_limit); | ||
long hitsurf_id = 0; | ||
auto step = vgbrep::protonav::BVHSurfNavigator<Precision>::ComputeStepAndNextSurface( | ||
globalpoint, globaldir, in_state, out_state, hitsurf_id, step_limit); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something here is misbehaving compared to the volume version:
for the calls
So it's claiming to have a boundary for the next surface, even though it doesn't hit it within the step limit. |
||
return step; | ||
} | ||
|
||
|
@@ -93,22 +102,29 @@ class SurfNavigator | |
ComputeStepAndPropagatedState(Vector3D const& globalpoint, | ||
Vector3D const& globaldir, | ||
Precision step_limit, | ||
vecgeom::NavStateIndex const& in_state, | ||
vecgeom::NavStateIndex& out_state, | ||
Precision push = 0) | ||
vecgeom::NavigationState const& in, | ||
vecgeom::NavigationState& out) | ||
{ | ||
return ComputeStepAndNextVolume( | ||
globalpoint, globaldir, step_limit, in_state, out_state, push); | ||
return ComputeStepAndNextVolume(globalpoint, globaldir, step_limit, in, out); | ||
} | ||
|
||
// Relocate a state that was returned from ComputeStepAndNextVolume: the | ||
// surface model does this computation within ComputeStepAndNextVolume, so | ||
// the relocation does nothing | ||
CELER_FUNCTION static void | ||
RelocateToNextVolume(Vector3D const& /*globalpoint*/, | ||
Vector3D const& /*globaldir*/, | ||
vecgeom::NavStateIndex& /*state*/) | ||
RelocateToNextVolume(Vector3D const& globalpoint, | ||
Vector3D const& globaldir, | ||
long hitsurf_index, | ||
vecgeom::NavigationState& out_state) | ||
{ | ||
vgbrep::CrossedSurface crossed_surf; | ||
vgbrep::protonav::BVHSurfNavigator<Precision>::RelocateToNextVolume( | ||
globalpoint, | ||
globaldir, | ||
Precision(0), | ||
hitsurf_index, | ||
out_state, | ||
crossed_surf); | ||
} | ||
}; | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've verified that this header (and the
VECGEOM_VERSION
macro therein) are present in v1.2.4, which is the minimum vecgeom required by Celeritas.