mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
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.
This commit is contained in:
parent
9036e79c10
commit
998a41fff3
1 changed files with 7 additions and 0 deletions
|
|
@ -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<double> 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<double>&coeffs() const { return coef_; }
|
||||
private:
|
||||
std::vector<double> coef_; //!< Polynomial coefficients
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue