mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Create [simple] Tabulated1D with x and y vectors
Allow the creation of openmc::Tabulated1D objects using x and y vectors. The implementation is simple and does not handle any breakpoints, assuming all y data can be linearly interpolated.
This commit is contained in:
parent
998a41fff3
commit
3a72bcfb10
2 changed files with 16 additions and 0 deletions
|
|
@ -81,6 +81,12 @@ public:
|
|||
//! \param[in] dset Dataset containing tabulated data
|
||||
explicit Tabulated1D(hid_t dset);
|
||||
|
||||
//! Construct using x and y data
|
||||
//! \param[in] x independent variable
|
||||
//! \param[in] y dependent variable to be interpolated
|
||||
//! Assumes no breakpoints with linear interpolation
|
||||
Tabulated1D(std::vector<double> x, std::vector<double> y);
|
||||
|
||||
//! Evaluate the tabulated function
|
||||
//! \param[in] x independent variable
|
||||
//! \return Function evaluated at x
|
||||
|
|
|
|||
10
src/endf.cpp
10
src/endf.cpp
|
|
@ -151,6 +151,16 @@ Tabulated1D::Tabulated1D(hid_t dset)
|
|||
n_pairs_ = x_.size();
|
||||
}
|
||||
|
||||
Tabulated1D::Tabulated1D(std::vector<double> x, std::vector<double> y)
|
||||
{
|
||||
x_ = x;
|
||||
y_ = y;
|
||||
n_pairs_ = x.size();
|
||||
int_.push_back(Interpolation::lin_lin);
|
||||
nbt_.push_back(x.size());
|
||||
n_regions_ = 1;
|
||||
}
|
||||
|
||||
double Tabulated1D::operator()(double x) const
|
||||
{
|
||||
// find which bin the abscissa is in -- if the abscissa is outside the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue