From 998a41fff34204af4493d1d1971e7fb1040f636d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Sep 2019 17:01:01 -0500 Subject: [PATCH] Create Polynomial with coefficients; Expose coefficients It is possible to create an openmc::Polynominal from the coefficient vector, rather than reading from a dataset. An accessor function, Polynominal::coeffs(), was added that returns the underlying coefficient vector. These are needed / useful for creating Polynomial instances with manipulated data. --- include/openmc/endf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/openmc/endf.h b/include/openmc/endf.h index 27958db5c5..61e82bec21 100644 --- a/include/openmc/endf.h +++ b/include/openmc/endf.h @@ -54,10 +54,17 @@ public: //! \param[in] dset Dataset containing coefficients explicit Polynomial(hid_t dset); + //! Construct polynomial using coefficients + //! \param[in] c Coefficients in order of increasing order + Polynomial(std::vector c) : coef_{c} {}; + //! Evaluate the polynomials //! \param[in] x independent variable //! \return Polynomial evaluated at x double operator()(double x) const override; + + // Accessor + const std::vector&coeffs() const { return coef_; } private: std::vector coef_; //!< Polynomial coefficients };