SHiP Geometry
SHiP experiment geometry implementation using GeoModel.
Loading...
Searching...
No Matches
StaticChecks.h File Reference
#include "SHiP/geometry/Units.h"
#include <array>
#include <cstddef>
#include <limits>
#include <utility>
Include dependency graph for StaticChecks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SHiP::geometry::checks::Span
 Closed interval along one axis. More...
struct  SHiP::geometry::checks::Box
 Axis-aligned box. More...

Namespaces

namespace  SHiP
namespace  SHiP::geometry
namespace  SHiP::geometry::checks
 Constexpr predicates for compile-time geometry consistency checks.

Typedefs

using SHiP::geometry::checks::LengthMm
 Spellings for struct members and function parameters.

Functions

constexpr Span SHiP::geometry::checks::span (LengthMm centre, LengthMm half)
 Interval of a volume with the given centre and half-length.
constexpr bool SHiP::geometry::checks::contains (Span outer, Span inner, LengthMm tol=0.0 *units::mm)
 inner lies within outer, allowing tol of slack at either end.
constexpr bool SHiP::geometry::checks::overlaps (Span a, Span b)
 The intervals share more than a boundary. Touching ends do not overlap.
constexpr Box SHiP::geometry::checks::box (LengthMm cx, LengthMm cy, LengthMm cz, LengthMm hx, LengthMm hy, LengthMm hz)
 Box with centre (cx, cy, cz) and the given half-lengths.
constexpr Box SHiP::geometry::checks::box (LengthMm hx, LengthMm hy, LengthMm hz)
 Box centred on the origin.
constexpr bool SHiP::geometry::checks::contains (const Box &outer, const Box &inner, LengthMm tol=0.0 *units::mm)
constexpr bool SHiP::geometry::checks::overlaps (const Box &a, const Box &b)
 Boxes overlap only if they overlap along every axis.
constexpr Box SHiP::geometry::checks::bounds (double x0, double x1, double y0, double y1, double z0, double z1)
 Box from its bounds in mm, for writing a known region down literally.
constexpr Box SHiP::geometry::checks::intersection (const Box &a, const Box &b)
 The region two boxes share. Only meaningful if they overlap.
constexpr bool SHiP::geometry::checks::overlapsWithin (const Box &a, const Box &b, const Box &region, LengthMm tol=1e-6 *units::mm)
 The boxes overlap, and only within region.
constexpr Box SHiP::geometry::checks::shrunk (const Box &b, LengthMm d)
 b with every face moved inwards by d.
template<typename Range, typename Pred>
constexpr std::size_t SHiP::geometry::checks::firstFailure (const Range &range, Pred ok)
 Index of the first element of range for which ok is false, or npos.
template<typename Range, typename Pred>
constexpr std::size_t SHiP::geometry::checks::firstPairFailure (const Range &range, Pred ok)
 Index i of the first neighbouring pair (range[i], range[i+1]) for which ok is false, or npos.
template<std::size_t N>
constexpr bool SHiP::geometry::checks::coveredBy (const Box &inner, const std::array< Box, N > &outers)
 Whether inner lies within the union of outers.

Variables

constexpr std::size_t SHiP::geometry::checks::npos = std::numeric_limits<std::size_t>::max()
 Returned by the first*() searches when every element passes.