![]() |
|
|||
File indexing completed on 2025-08-06 08:10:05
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include <algorithm> 0012 #include <array> 0013 0014 namespace Acts::detail { 0015 /// The StepperExtensionList allows to add an arbitrary number of step 0016 /// evaluation algorithms for the RKN4 evaluation. These can be categorised in 0017 /// two general types: 0018 /// a) Step evaluation that should not be evaluated along with other 0019 /// extensions, or at least would overwrite partial results. This means that 0020 /// in the best case unnecessary/redundant calculation would be performed, in 0021 /// the worst case the evaluation would go wrong. 0022 /// b) The step evaluation remains untouched and only further calculations are 0023 /// performed (like additional features or data gathering) that can be treated 0024 /// as independent of the basic step evaluation in type a). These types can be 0025 /// added but do not require special treatment in order to not ruin the step 0026 /// evaluation. 0027 /// The concept of the auctioneers aims in the first place to judge which 0028 /// extension of category a) is the one to go. Although every extension can 0029 /// judge if it is valid based on the data given from the state of stepper, 0030 /// multiple extensions from type a) could fulfill their dependencies. Since 0031 /// an extension does not know about other extensions, the decision for the 0032 /// best extension for the step can only be estimated on a global scope. This 0033 /// is the job of the auctioneers. 0034 /// 0035 /// TODO: An anticipation of an optimal concept of the input (and maybe also 0036 /// the output) of the call operator of an auctioneer cannot be performed at 0037 /// the current stage. At the current stage, a real bid-system would be pure 0038 /// guessing. 0039 0040 /// @brief Auctioneer that takes all extensions as valid that make a valid bid 0041 struct VoidAuctioneer { 0042 /// @brief Default constructor 0043 VoidAuctioneer() = default; 0044 0045 /// @brief Call operator that returns the list of valid candidates as valids 0046 /// 0047 /// @param [in] vCandidates Candidates that are treated as valid extensions 0048 /// @return The to vCandidates identical list of valid extensions 0049 template <long unsigned int N> 0050 std::array<bool, N> operator()(std::array<int, N> vCandidates) const { 0051 std::array<bool, N> valids{}; 0052 0053 for (unsigned int i = 0; i < vCandidates.size(); i++) { 0054 valids[i] = (vCandidates[i] > 0) ? true : false; 0055 } 0056 return valids; 0057 } 0058 }; 0059 0060 /// @brief Auctioneer that states only the first one that makes a valid bid 0061 struct FirstValidAuctioneer { 0062 /// @brief Default constructor 0063 FirstValidAuctioneer() = default; 0064 0065 /// @brief Call operator that states the first valid extension as the only 0066 /// valid extension 0067 /// 0068 /// @param [in] vCandidates Candidates for a valid extension 0069 /// @return List with at most one valid extension 0070 template <long unsigned int N> 0071 std::array<bool, N> operator()(std::array<int, N> vCandidates) const { 0072 std::array<bool, N> valids = {}; 0073 0074 for (unsigned int i = 0; i < vCandidates.size(); i++) { 0075 if (vCandidates[i] > 0) { 0076 valids[i] = true; 0077 return valids; 0078 } 0079 } 0080 return valids; 0081 } 0082 }; 0083 0084 /// @brief Auctioneer that makes only the highest bidding extension valid. If 0085 /// multiple elements have the same int, the first one with this value is 0086 /// picked. 0087 struct HighestValidAuctioneer { 0088 /// @brief Default constructor 0089 HighestValidAuctioneer() = default; 0090 0091 /// @brief Call operator that states the highest bidding extension as the 0092 /// only 0093 /// valid extension 0094 /// 0095 /// @param [in] vCandidates Candidates for a valid extension 0096 /// @return List with at most one valid extension 0097 template <long unsigned int N> 0098 std::array<bool, N> operator()(std::array<int, N> vCandidates) const { 0099 std::array<bool, N> valids = {}; 0100 0101 auto highscore = std::max_element(vCandidates.begin(), vCandidates.end()); 0102 valids.at(std::distance(vCandidates.begin(), highscore)) = true; 0103 0104 return valids; 0105 } 0106 }; 0107 0108 } // namespace Acts::detail
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |