Program Listing for File SpecsynLibNoWind.hpp

↰ Return to documentation for file (src/specsyn/SpecsynLibNoWind.hpp)

#ifndef SPECSYNLIBNOWIND_HPP
#define SPECSYNLIBNOWIND_HPP

#include "../io/SimControls.hpp"
#include "Specsyn.hpp"
#include "SpecsynCommons.hpp"
#include "SpecsynLib.hpp"
#include <cstddef>
#include <optional>
#include <string>
#include <vector>

namespace specsyn
{

    template <OOBPolicy Policy>
    class SpecsynLibNoWind : public SpecsynLib<Policy>
    {
    public:

        SpecsynLibNoWind(
            const std::string& spectraName,
            double fehMin,
            double fehMax,
            double afe,
            double cfe,
            double microTurb,
            double r,
            const std::string& registryName,
            double wlMin,
            double wlMax,
            std::size_t nWl,
            const io::SimControls& controls);

        [[nodiscard]] auto spec(const Specsyn::StarData& props, double feh) const
        -> std::vector<double> override;

        [[nodiscard]] auto specForce(const Specsyn::StarData& props, double feh) const
        -> std::vector<double> override;

        [[nodiscard]] auto logTeff() const -> const std::vector<double>& { return logTeff_; }

        [[nodiscard]] auto logg() const -> const std::vector<double>& { return logg_; }

        [[nodiscard]] auto fehMin() const -> double override { return FeH_.front(); }

        [[nodiscard]] auto fehMax() const -> double override { return FeH_.back(); }

        [[nodiscard]] auto loggMin() const -> double override { return logg_.front(); }

        [[nodiscard]] auto loggMax() const -> double override { return logg_.back(); }

    private:

        [[nodiscard]] auto nearestPopulatedLogg(std::size_t f, std::size_t t, double targetLogg) const
        -> std::optional<std::size_t>;

        // References into the parent class's dim1_/dim2_/dim3_, named
        // for what they actually hold in this (FeH, logg, Teff)
        // specialization, so the constructor logic inherited from the
        // pre-refactor SpecsynLib can stay unchanged in everything but
        // name. Deliberately references rather than owned copies --
        // the actual storage lives in (and is sized by) the parent,
        // which knows nothing about what its three axes mean -- so the
        // avoid-const-or-ref-data-members check's usual objection
        // (disabling implicit copy/move assignment) doesn't apply in
        // practice: this class is only ever used through the same
        // non-copyable, non-movable ownership pattern (unique_ptr in
        // SpecsynLibChained) as every other Specsyn.
        std::vector<double>& FeH_;      // NOLINT(readability-identifier-naming, cppcoreguidelines-avoid-const-or-ref-data-members)
        std::vector<double>& logg_;     // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
        std::vector<double>& logTeff_;  // NOLINT(readability-identifier-naming, cppcoreguidelines-avoid-const-or-ref-data-members)

        double AFe_;        // NOLINT(readability-identifier-naming)
        double CFe_;            // NOLINT(readability-identifier-naming)
        double microTurb_;
        double r_;
    };

} // namespace specsyn

#endif // SPECSYNLIBNOWIND_HPP