Skip to content

Commit

Permalink
Merge branch 'main' into posix
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 29, 2024
2 parents 414f4d6 + 6a8c643 commit 3115050
Show file tree
Hide file tree
Showing 50 changed files with 282 additions and 386 deletions.
1 change: 0 additions & 1 deletion Core/ActsVersion.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ struct VersionInfo {
static VersionInfo fromLibrary();

bool operator==(const VersionInfo& other) const;
bool operator!=(const VersionInfo& other) const { return !(*this == other); }

friend std::ostream& operator<<(std::ostream& os, const VersionInfo& vi);

Expand Down
41 changes: 18 additions & 23 deletions Core/include/Acts/Definitions/Direction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Direction final {
/// @param scalar is the signed value
///
/// @return a direction enum
static inline constexpr Direction fromScalar(ActsScalar scalar) {
static constexpr Direction fromScalar(ActsScalar scalar) {
assert(scalar != 0);
return scalar >= 0 ? Value::Positive : Value::Negative;
}
Expand All @@ -53,16 +53,15 @@ class Direction final {
/// @param scalar is the signed value
///
/// @return a direction enum
static inline constexpr Direction fromScalarZeroAsPositive(
ActsScalar scalar) {
static constexpr Direction fromScalarZeroAsPositive(ActsScalar scalar) {
return scalar >= 0 ? Value::Positive : Value::Negative;
}

/// Convert and index [0,1] to a direction e.g. for sorting in
/// std::array<T, 2u>
///
/// @param index is the direction at input
static inline constexpr Direction fromIndex(std::size_t index) {
static constexpr Direction fromIndex(std::size_t index) {
if (index == 0u) {
return Value::Negative;
}
Expand All @@ -73,7 +72,7 @@ class Direction final {
/// objects in std::array<T, 2u>
///
/// @return either 0 or 1
inline constexpr std::size_t index() const {
constexpr std::size_t index() const {
if (m_value == Value::Negative) {
return 0u;
}
Expand All @@ -83,28 +82,24 @@ class Direction final {
/// Turns the direction into a signed value
///
/// @return a signed value
inline constexpr int sign() const { return static_cast<int>(m_value); }
constexpr int sign() const { return static_cast<int>(m_value); }

/// Reverse the direction
///
/// @return an opposite direction
inline constexpr Direction invert() const {
constexpr Direction invert() const {
return (m_value == Value::Positive) ? Value::Negative : Value::Positive;
}

std::string toString() const;

inline constexpr Direction() = default;
inline constexpr Direction(Value value) : m_value(value) {}
constexpr Direction() = default;
constexpr Direction(Value value) : m_value(value) {}

inline constexpr bool operator==(Direction other) const {
constexpr bool operator==(Direction other) const {
return m_value == other.m_value;
}

inline constexpr bool operator!=(Direction other) const {
return m_value != other.m_value;
}

private:
Value m_value = Value::Positive;
};
Expand All @@ -113,15 +108,15 @@ std::ostream& operator<<(std::ostream& os, Direction dir);

// Direction * T

inline constexpr int operator*(Direction dir, int value) {
constexpr int operator*(Direction dir, int value) {
return dir.sign() * value;
}

inline constexpr float operator*(Direction dir, float value) {
constexpr float operator*(Direction dir, float value) {
return dir.sign() * value;
}

inline constexpr double operator*(Direction dir, double value) {
constexpr double operator*(Direction dir, double value) {
return dir.sign() * value;
}

Expand All @@ -131,15 +126,15 @@ inline Acts::Vector3 operator*(Direction dir, const Acts::Vector3& value) {

// T * Direction

inline constexpr int operator*(int value, Direction dir) {
constexpr int operator*(int value, Direction dir) {
return value * dir.sign();
}

inline constexpr float operator*(float value, Direction dir) {
constexpr float operator*(float value, Direction dir) {
return value * dir.sign();
}

inline constexpr double operator*(double value, Direction dir) {
constexpr double operator*(double value, Direction dir) {
return value * dir.sign();
}

Expand All @@ -149,17 +144,17 @@ inline Acts::Vector3 operator*(const Acts::Vector3& value, Direction dir) {

// T *= Direction

inline constexpr int operator*=(int& value, Direction dir) {
constexpr int operator*=(int& value, Direction dir) {
value *= dir.sign();
return value;
}

inline constexpr float operator*=(float& value, Direction dir) {
constexpr float operator*=(float& value, Direction dir) {
value *= dir.sign();
return value;
}

inline constexpr double operator*=(double& value, Direction dir) {
constexpr double operator*=(double& value, Direction dir) {
value *= dir.sign();
return value;
}
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Definitions/PdgParticle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum PdgParticle : std::int32_t {
};

/// Convert an anti-particle to its particle and leave particles as-is.
static constexpr inline PdgParticle makeAbsolutePdgParticle(PdgParticle pdg) {
static constexpr PdgParticle makeAbsolutePdgParticle(PdgParticle pdg) {
const auto value = static_cast<std::int32_t>(pdg);
return static_cast<PdgParticle>((0 <= value) ? value : -value);
}
Expand Down
6 changes: 1 addition & 5 deletions Core/include/Acts/EventData/GenericBoundTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,7 @@ class GenericBoundTrackParameters {
(lhs.m_surface == rhs.m_surface) &&
(lhs.m_particleHypothesis == rhs.m_particleHypothesis);
}
/// Compare two bound track parameters for bitwise in-equality.
friend bool operator!=(const GenericBoundTrackParameters& lhs,
const GenericBoundTrackParameters& rhs) {
return !(lhs == rhs);
}

/// Print information to the output stream.
friend std::ostream& operator<<(std::ostream& os,
const GenericBoundTrackParameters& tp) {
Expand Down
5 changes: 0 additions & 5 deletions Core/include/Acts/EventData/GenericParticleHypothesis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@ class GenericParticleHypothesis {
return (lhs.m_absPdg == rhs.m_absPdg) && (lhs.m_mass == rhs.m_mass) &&
(lhs.m_chargeType == rhs.m_chargeType);
}
friend bool operator!=(const GenericParticleHypothesis<ChargeType>& lhs,
const GenericParticleHypothesis<ChargeType>& rhs) {
return (lhs.m_absPdg != rhs.m_absPdg) || (lhs.m_mass != rhs.m_mass) ||
(lhs.m_chargeType != rhs.m_chargeType);
}
};

} // namespace Acts
2 changes: 0 additions & 2 deletions Core/include/Acts/EventData/MultiTrajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ class TrackStateRange {
return false;
}

bool operator!=(const Iterator& other) const { return !(*this == other); }

ProxyType operator*() const { return *proxy; }
ProxyType operator*() { return *proxy; }
};
Expand Down
4 changes: 0 additions & 4 deletions Core/include/Acts/EventData/SourceLink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ struct SourceLinkAdapterIterator {
return m_iterator == other.m_iterator;
}

bool operator!=(const SourceLinkAdapterIterator& other) const {
return !(*this == other);
}

Acts::SourceLink operator*() const { return Acts::SourceLink{*m_iterator}; }

auto operator-(const SourceLinkAdapterIterator& other) const {
Expand Down
6 changes: 1 addition & 5 deletions Core/include/Acts/EventData/SpacePointProxyIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ class SpacePointProxyIterator {
SpacePointProxyIterator operator--(int);

bool operator==(const SpacePointProxyIterator& other) const;
bool operator!=(const SpacePointProxyIterator& other) const;
bool operator<(const SpacePointProxyIterator& other) const;
bool operator>(const SpacePointProxyIterator& other) const;
bool operator<=(const SpacePointProxyIterator& other) const;
bool operator>=(const SpacePointProxyIterator& other) const;
auto operator<=>(const SpacePointProxyIterator& other) const;

SpacePointProxyIterator& operator+=(const std::size_t offset);
SpacePointProxyIterator& operator-=(const std::size_t offset);
Expand Down
29 changes: 2 additions & 27 deletions Core/include/Acts/EventData/SpacePointProxyIterator.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,12 @@ template <typename container_t>
bool SpacePointProxyIterator<container_t>::operator==(
const SpacePointProxyIterator<container_t>& other) const {
return m_container == other.m_container && m_index == other.m_index;
;
}

template <typename container_t>
bool SpacePointProxyIterator<container_t>::operator!=(
auto SpacePointProxyIterator<container_t>::operator<=>(
const SpacePointProxyIterator<container_t>& other) const {
return !(*this == other);
}

template <typename container_t>
bool SpacePointProxyIterator<container_t>::operator<(
const SpacePointProxyIterator<container_t>& other) const {
return m_index < other.m_index;
}

template <typename container_t>
bool SpacePointProxyIterator<container_t>::operator>(
const SpacePointProxyIterator<container_t>& other) const {
return m_index > other.m_index;
}

template <typename container_t>
bool SpacePointProxyIterator<container_t>::operator<=(
const SpacePointProxyIterator<container_t>& other) const {
return m_index <= other.m_index;
}

template <typename container_t>
bool SpacePointProxyIterator<container_t>::operator>=(
const SpacePointProxyIterator<container_t>& other) const {
return m_index >= other.m_index;
return m_index <=> other.m_index;
}

template <typename container_t>
Expand Down
20 changes: 2 additions & 18 deletions Core/include/Acts/EventData/TrackProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,8 @@ class TrackProxyIterator {
return m_container == other.m_container && m_itrack == other.m_itrack;
}

bool operator!=(const TrackProxyIterator& other) const {
return !(*this == other);
}

bool operator<(const TrackProxyIterator& other) const {
return m_itrack < other.m_itrack;
}

bool operator>(const TrackProxyIterator& other) const {
return m_itrack > other.m_itrack;
}

bool operator<=(const TrackProxyIterator& other) const {
return m_itrack <= other.m_itrack;
}

bool operator>=(const TrackProxyIterator& other) const {
return m_itrack >= other.m_itrack;
auto operator<=>(const TrackProxyIterator& other) const {
return m_itrack <=> other.m_itrack;
}

ProxyType operator*() const { return m_container->getTrack(m_itrack); }
Expand Down
4 changes: 0 additions & 4 deletions Core/include/Acts/EventData/detail/DynamicKeyIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ class DynamicKeyIterator {
return m_it == other.m_it;
}

bool operator!=(const DynamicKeyIterator& other) const {
return m_it != other.m_it;
}

value_type operator*() const { return m_it->first; }

private:
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/EventData/detail/TestSourceLink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ struct TestSourceLink final {
TestSourceLink(TestSourceLink&&) = default;
TestSourceLink& operator=(const TestSourceLink&) = default;
TestSourceLink& operator=(TestSourceLink&&) = default;

bool operator==(const TestSourceLink& rhs) const {
return (m_geometryId == rhs.m_geometryId) && (sourceId == rhs.sourceId) &&
(indices == rhs.indices) && (parameters == rhs.parameters) &&
(covariance == rhs.covariance);
}
bool operator!=(const TestSourceLink& rhs) const { return !(*this == rhs); }

std::ostream& print(std::ostream& os) const {
os << "TestsSourceLink(geometryId=" << m_geometryId
<< ",sourceId=" << sourceId;
Expand Down
11 changes: 0 additions & 11 deletions Core/include/Acts/Geometry/Extent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ struct ExtentEnvelope {
return lhs.m_values == rhs.m_values;
}

/// Comparison operator between envelope sets
/// @param lhs the left hand side
/// @param rhs the right hand side
/// @return true if the envelopes are not equal
friend bool operator!=(const ExtentEnvelope& lhs, const ExtentEnvelope& rhs) {
return !(lhs.m_values == rhs.m_values);
}

private:
std::array<Envelope, numBinningValues()> m_values{};
};
Expand All @@ -108,9 +100,6 @@ class Extent {
/// Define a comparison operator
bool operator==(const Extent& e) const;

/// Define a comparison operator
bool operator!=(const Extent& e) const { return (!operator==(e)); }

/// Extend with a position vertex
///
/// @param vtx the vertex to be used for extending
Expand Down
7 changes: 2 additions & 5 deletions Core/include/Acts/Geometry/GeometryIdentifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,15 @@ class GeometryIdentifier {
/// Set the masked bits to id in the encoded value.
constexpr GeometryIdentifier& setBits(Value mask, Value id) {
m_value = (m_value & ~mask) | ((id << extractShift(mask)) & mask);
// return *this here so we need to write less lines in the set... methods
// return *this here that we need to write fewer lines in the setXXX methods
return *this;
}

friend constexpr bool operator==(GeometryIdentifier lhs,
GeometryIdentifier rhs) {
return lhs.m_value == rhs.m_value;
}
friend constexpr bool operator!=(GeometryIdentifier lhs,
GeometryIdentifier rhs) {
return lhs.m_value != rhs.m_value;
}

friend constexpr bool operator<(GeometryIdentifier lhs,
GeometryIdentifier rhs) {
return lhs.m_value < rhs.m_value;
Expand Down
1 change: 0 additions & 1 deletion Core/include/Acts/Geometry/Volume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class Volume : public GeometryObject {
BinningValue bValue) const override;

bool operator==(const Volume& other) const;
bool operator!=(const Volume& other) const;

/// Produces a 3D visualization of this volume
/// @param helper The visualization helper describing the output format
Expand Down
3 changes: 0 additions & 3 deletions Core/include/Acts/Material/Material.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ class Material {
(lhs.m_ar == rhs.m_ar) && (lhs.m_z == rhs.m_z) &&
(lhs.m_molarRho == rhs.m_molarRho);
}
friend constexpr bool operator!=(const Material& lhs, const Material& rhs) {
return !(lhs == rhs);
}
};

std::ostream& operator<<(std::ostream& os, const Material& material);
Expand Down
4 changes: 0 additions & 4 deletions Core/include/Acts/Material/MaterialSlab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ class MaterialSlab {
return (lhs.m_material == rhs.m_material) &&
(lhs.m_thickness == rhs.m_thickness);
}
friend constexpr bool operator!=(const MaterialSlab& lhs,
const MaterialSlab& rhs) {
return !(lhs == rhs);
}
};

std::ostream& operator<<(std::ostream& os, const MaterialSlab& materialSlab);
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Propagator/ConstrainedStep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class ConstrainedStep {
}

private:
inline static constexpr auto kNotSet = std::numeric_limits<Scalar>::max();
static constexpr auto kNotSet = std::numeric_limits<Scalar>::max();

/// the step size tuple
std::array<Scalar, 3> m_values = {kNotSet, kNotSet, kNotSet};
Expand Down
2 changes: 0 additions & 2 deletions Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {

// clang-format off
auto& operator++() { ++it; return *this; }
auto operator!=(const Iterator& other) const { return it != other.it; }
auto operator==(const Iterator& other) const { return it == other.it; }
auto operator*() const { return ComponentProxy(*it, s); }
// clang-format on
Expand Down Expand Up @@ -463,7 +462,6 @@ class MultiEigenStepperLoop : public EigenStepper<extension_t> {

// clang-format off
auto& operator++() { ++it; return *this; }
auto operator!=(const ConstIterator& other) const { return it != other.it; }
auto operator==(const ConstIterator& other) const { return it == other.it; }
auto operator*() const { return ConstComponentProxy{*it}; }
// clang-format on
Expand Down
Loading

0 comments on commit 3115050

Please sign in to comment.