.. _program_listing_file_src_yields_Yields.hpp: Program Listing for File Yields.hpp =================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/yields/Yields.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef YIELDS_HPP #define YIELDS_HPP #include "../elem/DecayChain.hpp" #include "../elem/ElemCommons.hpp" #include "YieldChannel.hpp" #include "YieldCommons.hpp" #include #include #include #include // NOLINT(misc-include-cleaner) #include #include #include #include #include #include namespace io { class SimControls; } // namespace io namespace yields { class Yields { public: using Array2D = std::mdspan>; // NOLINT(misc-include-cleaner) Yields(const io::SimControls& controls, std::string registryName = defaultRegistry); // Movable (moving yieldChannels_'s own ownership, and rebinding // controls_ to the same referent) but not assignable (controls_ // can't be reseated, matching Extinct's/Specsyn's own identical // controls_ members -- see either one's own comment). // Deliberately kept non-copyable too, even though // yieldChannels_'s own shared_ptr elements are // themselves freely copyable: a shallow copy would leave two // Yields instances sharing the same live YieldChannel objects // while each computes its own, independent isotopes_ from them // -- calling rebuildYieldGrid() on one would silently remap the // shared channels' own yield grids out from under the other. Yields(const Yields&) = delete; Yields(Yields&&) = default; auto operator=(const Yields&) -> Yields& = delete; auto operator=(Yields&&) -> Yields& = delete; ~Yields() = default; void addChannel(const YieldChannelDescriptor& descriptor); void addChannel(std::unique_ptr channel); void checkInstalledCoverage(double candMin, double candMax) const; void deleteChannel(std::size_t index); void setChannels(std::vector> channels); void setChannels(const std::vector& descriptors); void rebuildYieldGrid(const elem::IsotopeList& isotopes = {}); [[nodiscard]] auto controls() const -> const io::SimControls& { return controls_; } [[nodiscard]] auto registryName() const -> const std::string& { return registryName_; } [[nodiscard]] auto yieldChannels() const -> const std::vector>& { return yieldChannels_; } [[nodiscard]] auto isotopes() const -> const elem::IsotopeList& { return isotopes_; } [[nodiscard]] auto skippedIsotopes() const -> const elem::IsotopeList& { return skippedIsotopes_; } [[nodiscard]] auto requestedIsotopes() const -> const elem::IsotopeList& { return requestedIsotopes_; } [[nodiscard]] auto requestedFehMin() const -> double { double result = -std::numeric_limits::infinity(); for (const auto& channel : yieldChannels_) { result = std::max(result, channel->requestedFehMin()); } return result; } [[nodiscard]] auto requestedFehMax() const -> double { double result = std::numeric_limits::infinity(); for (const auto& channel : yieldChannels_) { result = std::min(result, channel->requestedFehMax()); } return result; } [[nodiscard]] auto yield(double mass, double feH, double dtDecay = 0.0) const -> std::pair>; [[nodiscard]] auto yieldSum(double mass, double feH, double dtDecay = 0.0) const -> std::vector; [[nodiscard]] auto hasYield(double mass, Channel channel) const -> bool; [[nodiscard]] auto hasYield(double mass, double feH, Channel channel) const -> bool; void applyDecay(double dtDecay, std::span values) const; void applyDecay(double dtDecay, std::span values, bool decomposed) const; private: const io::SimControls& controls_; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members) -- deliberately a live reference, not a copy, matching Extinct's/Specsyn's own identical controls_ members exactly -- see either one's own comment for why. Only ever used through the same shared_ptr ownership pattern (shared_ptr in SimControls's own yields_) as those, so the usual objection (disabling implicit copy/move assignment) doesn't apply in practice. std::string registryName_; std::vector> yieldChannels_; elem::IsotopeList isotopes_; elem::IsotopeList skippedIsotopes_; elem::IsotopeList requestedIsotopes_; std::optional decayChain_; }; } // namespace yields #endif // YIELDS_HPP