Concepts
Todo
Not complete yet
Tracking geometry
Volume
Volume bounds
Tracking volume
Portals
-
class Portal
A portal connects two or more neighboring volumes.
Each volume has a set of portals that describes which volumes lie behind the portal in that direction. Portals use associated portal links to perform lookups of target volumes. Each portal has two links, and a corresponding surface. One link is associated with the direction along the surface’s normal vector, and one with the opposite direction.
Public Functions
-
Portal(const GeometryContext &gctx, Arguments &&args)
Constructor that takes a geometry context and an rvalue reference to a helper struct from above.
This pattern allows you to use designated initializers to construct this object like:
Portal{gctx, {.oppositeNormal = {cyl1, *vol1}}}; Portal{gctx, {.alongNormal = {cyl2, *vol2}}};
- Parameters:
gctx – The geometry context
args – The struct containing the arguments
-
Portal(const GeometryContext &gctx, std::unique_ptr<PortalLinkBase> alongNormal, std::unique_ptr<PortalLinkBase> oppositeNormal)
Constructor for a portal from two links.
One of the links can be
nullptr
, but at least one of them needs to be set. If both are set, they need to be valid compatible links that can be fused.- Parameters:
gctx – The geometry context
alongNormal – The link along the normal of the surface
oppositeNormal – The link opposite to the normal of the
Constructor for a portal from a surface and volume, where a trivial portal link is automatically constructed.
- Parameters:
direction – The direction of the link
surface – The surface from which to create the portal link
volume – The volume this portal connects to in the
direction
relative to the normal ofsurface
.
-
Portal(Direction direction, std::unique_ptr<PortalLinkBase> link)
Constructor for a portal from a single link.
- Parameters:
direction – The direction of the link
link – The portal link
-
void fill(TrackingVolume &volume)
Create and attach a trivial portal link to the empty slot of this portal.
- Parameters:
volume – The target volume to connect to
-
const PortalLinkBase *getLink(Direction direction) const
Get the link associated with the
direction
.Can be null if the associated link is unset.
- Parameters:
direction – The direction
- Returns:
The link (can be null)
-
bool isValid() const
Returns true if the portal is valid, that means it has at least one non-null link associated.Portals can be in an invalid state after they get merged or fused with other portals.
- Returns:
True if the portal is valid
-
Result<const TrackingVolume*> resolveVolume(const GeometryContext &gctx, const Vector3 &position, const Vector3 &direction) const
Resolve the volume for a 3D position and a direction The
direction
is used to select the right portal link, if it is set.In case no link is found in the specified direction, a
nullptr
is returned.- Parameters:
gctx – The geometry context
position – The 3D position
direction – The direction
- Returns:
The target volume (can be
nullptr
)
Helper function create a trivial portal link based on a surface.
Note
The
surface
must be logically equivalent to the one of the link that’s already set on the portal.- Parameters:
gctx – The geometry context
direction – The direction of the link to create
surface – The surface
volume – The target volume
-
void setLink(const GeometryContext &gctx, Direction direction, std::unique_ptr<PortalLinkBase> link)
Set a link on the portal into the slot specified by the direction.
Note
The surface associated with
link
must be logically equivalent to the one of the link that’s already set on the portal.- Parameters:
gctx – The geometry context
direction – The direction
link – The link to set
-
RegularSurface &surface()
Access the portal surface that is shared between the two links.
- Returns:
The portal surface
-
const RegularSurface &surface() const
Access the portal surface that is shared between the two links.
- Returns:
The portal surface
Public Static Functions
-
static Portal fuse(const GeometryContext &gctx, Portal &aPortal, Portal &bPortal, const Logger &logger = getDummyLogger())
Fuse two portals together.
Fusing is the combination of two portal links on the same logical surfaces. The actual surface instances can be different, as long as they are geometrically equivalent (within numerical precision). The resulting portal will have one portal along the shared surface’s normal vector, and one opposite that vector.
portal1 portal2 +---+ +---+ | | | | | | | | <----+ | + | +----> | | | | | | | | +---+ +---+
Note
The input portals need to have compatible link loadaout, e.g. one portal needs to have the along normal slot filled, and the otherone one needs to have the opposite normal slot filled. If portals share a filled slot, the function throws an exception.
Note
This is a destructive operation on the portals involved
- Parameters:
gctx – The geometry context
aPortal – The first portal
bPortal – The second portal
logger – The logger to push output to
-
static Portal merge(const GeometryContext &gctx, Portal &aPortal, Portal &bPortal, AxisDirection direction, const Logger &logger = getDummyLogger())
Merge two adjacent portals with each other to produce a new portal that encompasses both inputs.
It is the complementary operation to the fusing of portals. To be able to merge portals, the surfaces of their associated links need to be mergeable, and the portal links need to be compatible. This means that both portals need to have a link along the portal surface normal, opposite the normal, or both. If the equipped links are opposite relative to one another (e.g. one along one opposite), the function will throw an exception.
^ ^ | | portal1| portal2| +-------+-------+ +-------+-------+ | | + | | +-------+-------+ +-------+-------+ | | | | v v
Note
This is a destructive operation on both portals, their links will be moved to produce merged links, which can fail if the portal links are not compatible
- Parameters:
gctx – The geometry context
aPortal – The first portal
bPortal – The second portal
direction – The direction of the merge (e.g. along z)
logger – The logger to push output to
-
struct Arguments
Helper struct for the arguments to the portal constructor below using designated initializers.
Public Members
-
struct Link
Aggregate over a surface and a volume with optional semantics.
Public Members
-
std::shared_ptr<RegularSurface> surface = nullptr
The associated surface.
-
TrackingVolume *volume = nullptr
The associated volume.
-
std::shared_ptr<RegularSurface> surface = nullptr
-
struct Link
-
Portal(const GeometryContext &gctx, Arguments &&args)
Portal links
-
class PortalLinkBase
PortalLinkBase is the abstract base class for all portal links.
A portal link is a mapping between a surface and a point on the surface and a destination tracking volum. The derived classes implement different ways to resolve a volume
Subclassed by Acts::CompositePortalLink, Acts::GridPortalLink, Acts::TrivialPortalLink
Public Functions
-
virtual ~PortalLinkBase() = default
Virtual destructor in case the object is held as a derived.
-
virtual Result<const TrackingVolume*> resolveVolume(const GeometryContext &gctx, const Vector2 &position, double tolerance = s_onSurfaceTolerance) const = 0
Resolve a volume given a local position.
The local position is assumed to be on surface.
- Parameters:
gctx – The geometry context
position – The local position
tolerance – The tolerance for the lookup
- Returns:
The tracking volume or null if no connection was found
-
virtual Result<const TrackingVolume*> resolveVolume(const GeometryContext &gctx, const Vector3 &position, double tolerance = s_onSurfaceTolerance) const = 0
Resolve a volume given a global position.
Depending on the derived class, the global position might be converted to a local position before lookup.
- Parameters:
gctx – The geometry context
position – The global position
tolerance – The tolerance for the lookup
- Returns:
The tracking volume or null if no connection was found
Setter for the surface.
- Parameters:
surface – The surface
-
inline const RegularSurface &surface() const
Getter for the associated surface.
- Returns:
The surface
-
inline const std::shared_ptr<RegularSurface> &surfacePtr() const
Getter for the underlying shared pointer.
- Returns:
The shared pointer to the surface
-
virtual void toStream(std::ostream &os) const = 0
Stream output function.
- Parameters:
os – The output stream
Public Static Functions
-
static std::unique_ptr<PortalLinkBase> merge(std::unique_ptr<PortalLinkBase> a, std::unique_ptr<PortalLinkBase> b, AxisDirection direction, const Logger &logger = getDummyLogger())
Merge two portal link into a single one.
The merge can resolve combinations of difference derived classes, and will try to flatten and deep merge given links if possible.
- Parameters:
a – The first portal link
b – The second portal link
direction – The binning direction in which to merge. Valid values are depend on the surface types associated with the links.
logger – The logger to use for messages
- Returns:
The merged portal link
Friends
-
inline friend std::ostream &operator<<(std::ostream &os, const PortalLinkBase &link)
Stream output operator.
- Parameters:
os – The output stream
link – The portal link
-
virtual ~PortalLinkBase() = default
Trivial portal link
-
class TrivialPortalLink : public Acts::PortalLinkBase
Trivial portal link links to a single target volume on every point on a surface.
Public Functions
Construct a trivial portal link from a surface and a volume.
- Parameters:
surface – is the surface
volume – is the target
-
std::unique_ptr<GridPortalLink> makeGrid(AxisDirection direction) const
Make a 1D grid portal link from this trivial portal link The grid size is automatically determined from the surface bounds.
- Parameters:
direction – The axis direction of the grid
- Returns:
A grid
-
virtual Result<const TrackingVolume*> resolveVolume(const GeometryContext &gctx, const Vector2 &position, double tolerance = s_onSurfaceTolerance) const override
Resolve the volume for a 2D position.
Note
Always returns the single target volume
- Parameters:
gctx – is the geometry context
position – is the 2D position
tolerance – is the tolerance
- Returns:
The target volume (can be null)
-
virtual Result<const TrackingVolume*> resolveVolume(const GeometryContext &gctx, const Vector3 &position, double tolerance = s_onSurfaceTolerance) const override
Resolve the volume for a 3D position.
Note
Always returns the single target volume
Note
The position is assumed to be on the associated surface.
- Parameters:
gctx – is the geometry context
position – is the 2D position
tolerance – is the tolerance
- Returns:
The target volume (can be null)
-
virtual void toStream(std::ostream &os) const override
Print the portal link to a stream.
- Parameters:
os – output stream
-
const TrackingVolume &volume() const
Get the single volume that this trivial portal link is associated with.
- Returns:
The target volume
Grid portal link
-
class GridPortalLink : public Acts::PortalLinkBase
GridPortalLink implements a subdivided surface where the target volume depends on the position on the surface.
The link can be in two states:
One-dimensional binning with an associated direction to determine which local coordinate to use for the lookup
Two-dimensional binning
Note
The grid dimensions and boundaries are required (and checked) to be consistent with the surface bounds.
Public Functions
-
virtual unsigned int dim() const = 0
Get the number of dimensions of the grid.
- Returns:
The number of dimensions
-
inline AxisDirection direction() const
The binning direction of the grid.
Note
For 2D grids, this will always be the loc0 direction, depending on the surface type.
- Returns:
The binning direction
-
virtual std::unique_ptr<GridPortalLink> extendTo2d(const IAxis *other) const = 0
Expand a 1D grid to a 2D one, by using the provided axis along the missing direction.
- Parameters:
other – The axis to use for the missing direction, can be null for auto determination
- Returns:
A unique pointer to the 2D grid portal link
-
virtual const IGrid &grid() const = 0
Return the associated grid in a type-erased form.
- Returns:
The grid
-
void printContents(std::ostream &os) const
Helper function that prints a textual representation of the grid with the volume names.
- Parameters:
os – The output stream
-
virtual void setVolume(TrackingVolume *volume) = 0
Set the volume on all grid bins.
- Parameters:
volume – The volume to set
Public Static Functions
-
static void fillMergedGrid(const GridPortalLink &a, const GridPortalLink &b, GridPortalLink &merged, AxisDirection direction, const Logger &logger)
Helper function to fill the bin contents after merging.
This called by the merging routine, and requires access to the internal grid state.
- Parameters:
a – The first grid portal link
b – The second grid portal link
merged – The merged grid portal link
direction – The merging direction
logger – The logger to use for messages
Factory function for an automatically sized one-dimensional grid.
This produces a single-bin grid with boundaries taken from the bounds of
surface
alongdirection
.- Parameters:
surface – The surface
volume – The tracking volume
direction – The binning direction
- Returns:
A unique pointer to the grid portal link
Factory function for a two-dimensional grid portal link, which allows using template deduction to figure out the right type.
Note
The axis boundaries are checked against the bounds of
surface
.- Template Parameters:
axis_1_t – The first axis type
axis_2_t – The second axis type
- Parameters:
surface – The surface
axis1 – The first axis to use for the binning
axis2 – The second axis to use for the binning
- Returns:
A unique pointer to the grid portal link
Factory function for a one-dimensional grid portal link, which allows using template deduction to figure out the right type.
Note
The axis boundaries are checked against the bounds of
surface
.- Template Parameters:
axis_t – The axis type
- Parameters:
surface – The surface
direction – The binning direction
axis – The axis to use for the binning
- Returns:
A unique pointer to the grid portal link
-
static std::unique_ptr<PortalLinkBase> merge(const GridPortalLink &a, const GridPortalLink &b, AxisDirection direction, const Logger &logger = getDummyLogger())
Merge two grid portal links into a single one.
The routine can merge one-dimenaional, tow-dimensional and mixed links. The merge will try to preserve equidistant binning in case bin widths match. Otherwise, the merge falls back to variable binning.
1D merge scenarios:
+----------------------------------------------------------+ |Colinear | | | | +-------+-------+-------+ +-------+-------+-------+ | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | +-------+-------+-------+ +-------+-------+-------+ | | +-------+-------+-------+-------+-------+-------+ | | | | | | | | | | | = | | | | | | | | | | | | | | | | | | +-------+-------+-------+-------+-------+-------+ | | | +----------------------------------------------------------+
Two grid along a shared direction are merged along their shared direction
+-------------------------------------------------+ |Parallel | | | | +-------+ +-------+ +-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+ +-------+ +-------+-------+ | | | | | | | | | | | | | + | | = | | | | | | | | | | | | | | +-------+ +-------+ +-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+ +-------+ +-------+-------+ | | | +-------------------------------------------------+
Two grids along a shared direction a merged in the direction that is orthogonal to their shared direction.
+-------------------------------------------+ |Perpendicular | | | | +-------+ | | | | | | | | | | | | | | +-------+ +-------+-------+-------+ | | | | | | | | | | | | + | | | | | | | | | | | | | | +-------+ +-------+-------+-------+ | | | | | | | | | | | | +-------+-------+-------+ | | +-------+ | | | | | | | | | | | | | | | | | | +-------+-------+-------+ | | | | | | | | = | | | | | | | | | | | | +-------+-------+-------+ | | | | | | | | | | | | | | | | | | | | +-------+-------+-------+ | | | +-------------------------------------------+
Two grids whose directions are not shared are merged (ordering does not matter here). The routine will expand one of the grids to match the other’s binning, by subdividing the grid in the as-of-yet unbinned direction, while filling all bins with the original bin contents. Afterwards, a conventional mixed-dimension merge is performed.
Mixed merge scenarios The order is normalized by always taking the 2D grid as the left hand side. The 1D grid is expanded to match the binning in the as-of-yet unbinned direction with the binning taken from the 2D grid.
+-----------------------------------------+ |2D + 1D | | | | +-------+-------+ +-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+ +-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+ = +-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+ +-------+-------+ | | + | | | | | +-------+-------+ | | | | | | | | | | | | | | | | +-------+-------+ | | | | | | | +-------+-------+ | +-----------------------------------------+
+--------------------------------------------------------------+ |2D + 1D | | | | +-------+-------+ +-------+ +-------+-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+ +-------+ +-------+-------+-------+ | | | | | | | | | | | | | | | | + | | = | | | | | | | | | | | | | | | | | +-------+-------+ +-------+ +-------+-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+ +-------+ +-------+-------+-------+ | | | +--------------------------------------------------------------+
2D merges The grids need to already share a common axis. If that is not the case, the merge routine returns a
nullptr
. This can be handled by composite merging as a fallback if needed. Ordering and direction does not matter here.+-----------------------------------------+ |2D + 2D | | | | +-------+-------+ +-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+ +-------+-------+ | | | | | | | | | | | | | + | | | | | | | | | | | | | +-------+-------+ +-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+ +-------+-------+ | | | | +-------+-------+-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+-------+-------+ | | | | | | | | | = | | | | | | | | | | | | | | +-------+-------+-------+-------+ | | | | | | | | | | | | | | | | | | | | | | | +-------+-------+-------+-------+ | | | +-----------------------------------------+
Note
The returned pointer can be nullptr, if the grids given are not mergeable, because their binnings are not compatible. This is not an error case, and needs to be handled by th caller! Invalid input is handled via exceptions.
- Parameters:
a – The first grid portal link
b – The second grid portal link
direction – The merging direction
logger – The logger to use for messages
- Returns:
The merged grid portal link or nullptr if grid merging did not succeed
Warning
doxygenclass: Cannot find class “Acts::GridPortalLinkT” in doxygen xml output for project “Acts” from directory: _build/doxygen-xml
Composite portal link
-
class CompositePortalLink : public Acts::PortalLinkBase
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 the result on the first surface where the lookup position is within bounds.
Public Functions
-
CompositePortalLink(std::unique_ptr<PortalLinkBase> a, std::unique_ptr<PortalLinkBase> b, AxisDirection direction, bool flatten = true)
Construct a composite portal from two arbitrary other portal links.
The only requirement is that the portal link surfaces are mergeable.
- Parameters:
a – The first portal link
b – The second portal link
direction – The binning direction
flatten – If true, the composite will flatten any nested composite
-
CompositePortalLink(std::vector<std::unique_ptr<PortalLinkBase>> links, AxisDirection direction, bool flatten = true)
Construct a composite portal from any number of arbitrary other portal links.
The only requirement is that the portal link surfaces are mergeable.
- Parameters:
links – The portal links
direction – The binning direction
flatten – If true, the composite will flatten any nested composite
-
std::size_t depth() const
Get the depth of the composite tree.
- Returns:
The depth
-
std::unique_ptr<GridPortalLink> makeGrid(const GeometryContext &gctx, const Logger &logger) const
(Potentially) create a grid portal link that represents this composite portal link.
Note
This only works, if the composite is flat and only contains trivial portal links. If these preconditions are not met, this function returns a nullptr.
- Parameters:
gctx – The geometry context
logger – The logger
- Returns:
The grid portal link
-
virtual Result<const TrackingVolume*> resolveVolume(const GeometryContext &gctx, const Vector2 &position, double tolerance = s_onSurfaceTolerance) const override
Resolve the volume for a 2D position.
Note
This will transform the position to global coordinates before consulting its children.
Note
position
is assumed to be on surface- Parameters:
gctx – The geometry context
position – The 2D position
tolerance – The on-surface tolerance
-
virtual Result<const TrackingVolume*> resolveVolume(const GeometryContext &gctx, const Vector3 &position, double tolerance = s_onSurfaceTolerance) const override
Resolve the volume for a 3D position.
Note
position
is assumed to be on surface- Parameters:
gctx – The geometry context
position – The 3D position
tolerance – The tolerance
-
std::size_t size() const
Get the number of children.
- Returns:
The number of children
-
virtual void toStream(std::ostream &os) const override
Print the composite portal link.
- Parameters:
os – The output stream
-
CompositePortalLink(std::unique_ptr<PortalLinkBase> a, std::unique_ptr<PortalLinkBase> b, AxisDirection direction, bool flatten = true)
Portal shells
-
class PortalShellBase
The portal shell of a volume is the set of portals that describes connections “outside” of the volume.
Which boundary surfaces of a volume are included in the shell depends on the volume. Portal shells are only used during geometry construction, and are not part of the final geometry description.
This class is the base class for all portal shells
Subclassed by Acts::CylinderPortalShell
Public Functions
-
virtual ~PortalShellBase() = default
Virtusl destructor.
-
virtual void applyToVolume() = 0
Instruct the shell to register the portals with the volume, handing over shared ownership in the process.
Note
The target volume depends on the shell type, e.g. composite shells like the
CylinerStackPortalShell
register portals to the correct volumes.
-
virtual void fill(TrackingVolume &volume) = 0
Fill the open slots of the shell with a
TrivialPortalLink
to the givenvolume
.- Parameters:
volume – The volume to connect
-
virtual bool isValid() const = 0
Check if a portal is valid, e.g.
if non of the portals has two unconnected sides.
- Returns:
True if the shell is valid, false otherwise
-
virtual std::string label() const = 0
Get a label for the portal shell for debugging purposes.
- Returns:
A label for the portal shell
-
virtual std::size_t size() const = 0
Get the number of portals in the shell.
This number depends on the volume type
- Returns:
The number of portals in the shell
-
virtual ~PortalShellBase() = default
-
class CylinderPortalShell : public Acts::PortalShellBase
Base class for cylinder shaped portal shells, e.g.
shells for cylinder volumes
Subclassed by Acts::CylinderStackPortalShell, Acts::SingleCylinderPortalShell
Public Types
-
using Face = CylinderVolumeBounds::Face
-
enum class Face
Enum describing the possible faces of a cylinder volume.
Note
These values are synchronized with the BoundarySurfaceFace enum. Once Gen1 is removed, this can be changed.
Values:
Public Functions
-
virtual void fill(TrackingVolume &volume) override
Fill the open slots of the shell with a
TrivialPortalLink
to the givenvolume
.- Parameters:
volume – The volume to connect
-
virtual Portal *portal(Face face) = 0
Retrieve the portal associated to the given face.
Can be nullptr if unset.
- Parameters:
face – The face to retrieve the portal for
- Returns:
The portal associated to the face
-
virtual std::shared_ptr<Portal> portalPtr(Face face) = 0
Retrieve a shared_ptr for the portal associated to the given face.
Can be nullptr if unset.
- Parameters:
face – The face to retrieve the portal for
- Returns:
The portal associated to the face
Set the portal associated to the given face.
- Parameters:
portal – The portal to set
face – The face to set the portal
-
using Face = CylinderVolumeBounds::Face
-
class SingleCylinderPortalShell : public Acts::CylinderPortalShell
This class describes a cylinder shell containing a single volume.
The available faces depend on the configuration of the cylinder volume bounds. If a phi sector is configured, the shell will have corresponding portal slots. If the inner radius is non-zero, the shell will have an inner cylinder portal slot.
Public Functions
-
explicit SingleCylinderPortalShell(TrackingVolume &volume)
Construct a single cylinder portal shell for the given volume.
- Parameters:
volume – The volume to create the shell for
-
virtual void applyToVolume() override
Instruct the shell to register the portals with the volume, handing over shared ownership in the process.
Note
The target volume depends on the shell type, e.g. composite shells like the
CylinerStackPortalShell
register portals to the correct volumes.
-
virtual bool isValid() const override
Check if a portal is valid, e.g.
if non of the portals has two unconnected sides.
- Returns:
True if the shell is valid, false otherwise
-
virtual std::string label() const override
Get a label for the portal shell for debugging purposes.
- Returns:
A label for the portal shell
-
virtual Portal *portal(Face face) final
Retrieve the portal associated to the given face.
Can be nullptr if unset.
- Parameters:
face – The face to retrieve the portal for
- Returns:
The portal associated to the face
-
virtual std::shared_ptr<Portal> portalPtr(Face face) final
Retrieve a shared_ptr for the portal associated to the given face.
Can be nullptr if unset.
- Parameters:
face – The face to retrieve the portal for
- Returns:
The portal associated to the face
Set the portal associated to the given face.
- Parameters:
portal – The portal to set
face – The face to set the portal
-
virtual std::size_t size() const final
Get the number of portals in the shell.
This number depends on the volume type
- Returns:
The number of portals in the shell
-
explicit SingleCylinderPortalShell(TrackingVolume &volume)
-
class CylinderStackPortalShell : public Acts::CylinderPortalShell
This class describes a cylinder shell containing multiple volumes.
The available faces depend on the configuration of the cylinder volume bounds.
Fused +————–
—+ portals -—+ | | | | v OuterCylinder | +——+——+ | | | | | | | |<—+ +—+—+ v | | +—+———+ | | | | | Shared portal | | |<—+— (grid) | v | | PositiveDisc +———-—+ | r ^ | | | | | |<—+ | | | | +———-—+ InnerCylinder +–—> ^ (if rMin>0) z | | +————–—+Note
The stack shell currently does not support phi sectors The stack can be oriented along the (local) z or r direction, which drives the stacking. Depending on the direction, portals on the shells of children are merged or fused. Subsequently, portal access respects shared portals between shells. Below is an illustration of a stack in the r direction:
Note
The shells must be ordered in the given direction Depending on the stack direction, the portal lookup will return different portals. In the illustration above, the
PositiveDisc
portal is shared among all shells, while theOuterCylinder
andInnerCylinder
portals are looked up from the innermost and outermost shell in the r direction.Public Functions
-
CylinderStackPortalShell(const GeometryContext &gctx, std::vector<CylinderPortalShell*> shells, AxisDirection direction, const Logger &logger = getDummyLogger())
Construct the portal shell stack from the given shells.
Note
The shells must be ordered in the given direction
- Parameters:
gctx – The geometry context
shells – The shells to stack
direction – The stacking direction
logger – A logging instance for debugging
-
inline virtual void applyToVolume() override
Instruct the shell to register the portals with the volume, handing over shared ownership in the process.
Note
The target volume depends on the shell type, e.g. composite shells like the
CylinerStackPortalShell
register portals to the correct volumes.
-
virtual bool isValid() const override
Check if a portal is valid, e.g.
if non of the portals has two unconnected sides.
- Returns:
True if the shell is valid, false otherwise
-
virtual std::string label() const override
Get a label for the portal shell for debugging purposes.
- Returns:
A label for the portal shell
-
virtual Portal *portal(Face face) final
Retrieve the portal associated to the given face.
Can be nullptr if unset.
- Parameters:
face – The face to retrieve the portal for
- Returns:
The portal associated to the face
-
virtual std::shared_ptr<Portal> portalPtr(Face face) final
Retrieve a shared_ptr for the portal associated to the given face.
Can be nullptr if unset.
- Parameters:
face – The face to retrieve the portal for
- Returns:
The portal associated to the face
Set the portal associated to the given face.
- Parameters:
portal – The portal to set
face – The face to set the portal
-
virtual std::size_t size() const final
Get the number of portals in the shell.
This number depends on the volume type
- Returns:
The number of portals in the shell
-
CylinderStackPortalShell(const GeometryContext &gctx, std::vector<CylinderPortalShell*> shells, AxisDirection direction, const Logger &logger = getDummyLogger())