Skip to content
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

feat(geo): Gen3 portal links #3531

Merged
merged 101 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
1de1182
feat(geo): TrackingGeometry setVolumeName method
paulgessinger Aug 12, 2024
44e5903
feat(geo): TrackingVolume move constructor
paulgessinger Aug 21, 2024
c371fb7
feat(geo): `Surface::isOnSurface` gets tolerance parameter
paulgessinger Aug 22, 2024
3db513d
Portal stitching exploration
paulgessinger Jun 6, 2024
ba11b51
checkpoint w/o double-dispatch
paulgessinger Jun 6, 2024
13f1041
portal: more portal merging exploration
paulgessinger Jun 6, 2024
3d39501
fixes after axis refactor
paulgessinger Jun 6, 2024
f81860b
wip
paulgessinger Jul 3, 2024
b7e1899
fix axistype tags
paulgessinger Jun 10, 2024
7c5cf1f
portal testing
paulgessinger Jun 12, 2024
0db5fff
fix format
paulgessinger Aug 12, 2024
9d1466e
wip
paulgessinger Jun 23, 2024
47ec05e
wip2
paulgessinger Jun 24, 2024
52dd26c
wip
paulgessinger Jun 27, 2024
8ecf99b
wip
paulgessinger Jun 28, 2024
b430a4d
some colinear merging works
paulgessinger Jun 28, 2024
12558c4
some progress, i'm realizing i need to think more about phi stitching
paulgessinger Jun 29, 2024
56d568e
wip
paulgessinger Jul 3, 2024
22d40b1
remove gctx
paulgessinger Jul 3, 2024
6ad4bad
wip
paulgessinger Jul 3, 2024
d15e350
updates after BinningValue change
paulgessinger Jul 4, 2024
7e2b729
wip
paulgessinger Jul 5, 2024
bbe69d3
remove gctx, test more of the phi merging
paulgessinger Jul 8, 2024
8197ef9
1d cylinder merging sort of works
paulgessinger Jul 8, 2024
9b20720
unify axis creation a bit more
paulgessinger Jul 8, 2024
6bfb5e0
first attempt at 2D grid merging (might need some refactoring)
paulgessinger Jul 11, 2024
425cee3
expand 1D grid to 2D in preparation for further merging
paulgessinger Jul 12, 2024
e5fa9da
fix 2d portal merge memory error, complete tests
paulgessinger Jul 12, 2024
56d41c3
wip
paulgessinger Jul 12, 2024
8cf0803
towards full 2D and perpendicular merging
paulgessinger Jul 15, 2024
aca5823
perpendicular cylinder merge works
paulgessinger Jul 16, 2024
1496445
remove direction from template arguments (can be runtime)
paulgessinger Jul 16, 2024
513fbc8
fix format
paulgessinger Aug 12, 2024
04368a3
begin work on disc surfaces
paulgessinger Jul 17, 2024
d1356d3
start adding disc tests
paulgessinger Jul 18, 2024
eea71fd
first disc portal construction tests and shuffling of impl. code
paulgessinger Jul 18, 2024
09af2ba
fix format
paulgessinger Aug 12, 2024
fddc9de
tested disc merging
paulgessinger Jul 18, 2024
c5d82dd
rename 'perpendicular' case to 'parallel'
paulgessinger Jul 18, 2024
6011438
support mixed merging
paulgessinger Jul 18, 2024
9dc9429
portallinks keep a mutable shared ptr for the surface
paulgessinger Jul 18, 2024
24d71ad
split portal types up, start implementing conversion
paulgessinger Jul 18, 2024
ab40d48
1d to 2d extension in principle works with existing axes now
paulgessinger Jul 23, 2024
cfbf8fd
mixed merging carries over other axis
paulgessinger Jul 23, 2024
d6e222e
grid portal filling tested for 2D
paulgessinger Jul 23, 2024
3cb3e70
fix format
paulgessinger Aug 12, 2024
79bd1bd
cross merging works including bin contents
paulgessinger Jul 25, 2024
712d514
split up grid merging and rest of .cpp, push content printer to cpp
paulgessinger Jul 25, 2024
830fa3d
reduce verbosity a bit
paulgessinger Jul 25, 2024
b83a0ca
some more bin filling testing
paulgessinger Jul 25, 2024
159695d
grid construction from trivial working for discs
paulgessinger Jul 25, 2024
30f0a5f
reduce likelihood of surface confusion, fix tests
paulgessinger Jul 25, 2024
e4b390a
fix a few more cases or order-dependent bin edges
paulgessinger Jul 25, 2024
c937fc5
migrate merging model away from double dispatch
paulgessinger Aug 1, 2024
d69ee07
avoid one roundtrip method call
paulgessinger Aug 1, 2024
8284dca
composite construction including basic flattening
paulgessinger Aug 7, 2024
da3c638
composite by merging basically works
paulgessinger Aug 7, 2024
b0d0224
optimize memory usage at build-time
paulgessinger Aug 9, 2024
b5b1b72
enable composite fallback for grid merging
paulgessinger Aug 9, 2024
5da341d
accept mutable portal links so we can store them mutably in composite
paulgessinger Aug 9, 2024
952c6e0
fixes after dropping operator<< on Surface
paulgessinger Aug 9, 2024
9418092
remove unneeded code
paulgessinger Aug 9, 2024
23af824
internal storage of volumes becomes mutable
paulgessinger Aug 9, 2024
d121c5a
remove unneeded friend declarations
paulgessinger Aug 9, 2024
a4bb5da
cleanup
paulgessinger Aug 9, 2024
a14bccf
split up portallink tests and portal tests
paulgessinger Aug 9, 2024
8708d48
link: grid axes are allowed to be open
paulgessinger Aug 9, 2024
46a4107
link: resolveVolume interface, portal construction
paulgessinger Aug 9, 2024
32bfffc
link: fix: projection from 2D to 1D in grid was missing
paulgessinger Aug 12, 2024
890b7da
link: refactor memory model, more testing of fusing, and error cases
paulgessinger Aug 14, 2024
b44bc5e
link: TrivialPortalLink assertion for isOnSurface
paulgessinger Aug 21, 2024
3e39aa0
link: GridPortalLink graphical doc comment
paulgessinger Aug 21, 2024
07b0841
link: PortalLinkBase is standalone file
paulgessinger Aug 21, 2024
4303407
revert: Portal
paulgessinger Aug 21, 2024
6b36646
link: surfacePtr returns by reference
paulgessinger Aug 21, 2024
65ca8a7
link: PR feedback
paulgessinger Aug 22, 2024
cd7addf
link: Remove Portal.hpp include
paulgessinger Aug 22, 2024
c717c73
link: Pipe through tolerance in resolveVolume
paulgessinger Aug 22, 2024
2a6bf95
link: Remove visitBins in GridPortalLink
paulgessinger Aug 22, 2024
dfc4b31
link: Add documentation to method
paulgessinger Aug 22, 2024
b8c7a4e
link: resolveVolume returns Result
paulgessinger Aug 23, 2024
247306a
link: un-document unused parameters
paulgessinger Aug 23, 2024
36ba8a6
link: Fix unit tests after converting from exception to assertions
paulgessinger Aug 23, 2024
d7f93d0
fix(util): IAxis::visit ensures return
paulgessinger Aug 23, 2024
5696d1a
link: Lint fixes
paulgessinger Aug 23, 2024
3a57523
link: move TrivialPortalLink::toStream to cpp file
paulgessinger Aug 23, 2024
fb072b9
link: work around std::format not being available
paulgessinger Aug 23, 2024
779c5ee
Merge branch 'main' into feat/gen3-portal-links
paulgessinger Aug 26, 2024
2065f34
link: remove extra constructor
paulgessinger Aug 26, 2024
5d02f8d
Apply suggestions from code review
paulgessinger Aug 26, 2024
1ba08e1
link: add portal error for composite case
paulgessinger Aug 26, 2024
548df85
link: Make PortalLinkBase constructor explicit
paulgessinger Aug 26, 2024
1b43cb9
link: improve grid extension method name
paulgessinger Aug 26, 2024
bf638df
link: Remove funky else case assertion
paulgessinger Aug 26, 2024
9f713c5
link: doc / comment updates
paulgessinger Aug 26, 2024
280e084
link: don't use std::format at all
paulgessinger Aug 26, 2024
13a585d
link: make sonar happier
paulgessinger Aug 26, 2024
d8b9b3d
link: fix shadowed variable, remove explicit captures again
paulgessinger Aug 26, 2024
4a95288
link: Add explicit check for non-null surface
paulgessinger Aug 26, 2024
70a3e83
Merge branch 'main' into feat/gen3-portal-links
kodiakhq[bot] Aug 26, 2024
ec1c1db
Merge branch 'main' into feat/gen3-portal-links
kodiakhq[bot] Aug 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions Core/include/Acts/Geometry/CompositePortalLink.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// This file is part of the Acts project.
//
// Copyright (C) 2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Definitions/Tolerance.hpp"
#include "Acts/Geometry/PortalLinkBase.hpp"

#include <iosfwd>

#include <boost/container/small_vector.hpp>

namespace Acts {

/// Composite portal links can graft together other portal link instances, for
/// example grids that could not be merged due to invalid binnings.
///
/// +-------+ +-------+
/// | | | |
/// | | | |
/// | | | |
/// +-------+ | |
/// | | | |
/// | | + +-------+
/// | | | |
/// +-------+ | |
/// | | | |
/// | | +-------+
/// | | | |
/// +-------+ +-------+
///
/// During resolution, it will consult each of it's children and return result
/// of the resolution on the first surface where the lookup position is within
/// bounds.
paulgessinger marked this conversation as resolved.
Show resolved Hide resolved
class CompositePortalLink final : public PortalLinkBase {
public:
/// Construct a composite portal from two arbitrary other portal link. The
paulgessinger marked this conversation as resolved.
Show resolved Hide resolved
/// only requirement is that the portal link surfaces are mergeable.
/// @param a The first portal link
/// @param b The second portal link
/// @param direction The binning direction
/// @param flatten If true, the composite will flatten any nested composite
CompositePortalLink(std::unique_ptr<PortalLinkBase> a,
std::unique_ptr<PortalLinkBase> b, BinningValue direction,
bool flatten = true);

/// Print the composite portal link
/// @param os The output stream
void toStream(std::ostream& os) const final;

/// Resolve the volume for a 2D position
paulgessinger marked this conversation as resolved.
Show resolved Hide resolved
/// @note This will transform the position to global coordinates before
/// consulting its children.
/// @note @p position is assumed to be on surface
/// @param gctx The geometry context
/// @param position The 2D position
/// @param tolerance The tolerance
paulgessinger marked this conversation as resolved.
Show resolved Hide resolved
Result<const TrackingVolume*> resolveVolume(
const GeometryContext& gctx, const Vector2& position,
double tolerance = s_onSurfaceTolerance) const final;

/// Resolve the volume for a 3D position
/// @note @p position is assumed to be on surface
/// @param gctx The geometry context
/// @param position The 3D position
/// @param tolerance The tolerance
Result<const TrackingVolume*> resolveVolume(
const GeometryContext& gctx, const Vector3& position,
double tolerance = s_onSurfaceTolerance) const final;

/// Get the depth of the composite tree
/// @return The depth
std::size_t depth() const;

/// Get the number of children
/// @return The number of children
std::size_t size() const;

private:
/// Helper function to construct a merged surface from two portal links along
/// a given direction
/// @param a The first portal link
/// @param b The second portal link
/// @param direction The merging direction
/// @return The merged surface
static std::shared_ptr<RegularSurface> mergedSurface(const PortalLinkBase* a,
const PortalLinkBase* b,
BinningValue direction);

boost::container::small_vector<std::unique_ptr<PortalLinkBase>, 4>
m_children{};
};

} // namespace Acts
Loading
Loading