svZeroDSolver
Loading...
Searching...
No Matches
Parameter.h File Reference

model::Parameter source file More...

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
#include "DOFHandler.h"
Include dependency graph for Parameter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Parameter
 Model Parameter. More...
struct  InputParameter
 Handles the properties of input parameters. More...

Functions

double linear_interpolate (double x, const std::vector< double > &xs, const std::vector< double > &ys)
 Linearly interpolate y(x) from a table of break points.
double linear_interpolate_slope (double x, const std::vector< double > &xs, const std::vector< double > &ys)
 Local slope dy/dx of the piecewise-linear table used by linear_interpolate.

Detailed Description

model::Parameter source file

Function Documentation

◆ linear_interpolate()

double linear_interpolate ( double x,
const std::vector< double > & xs,
const std::vector< double > & ys )

Linearly interpolate y(x) from a table of break points.

Outside [xs.front(), xs.back()], the value is clamped to the nearest endpoint of ys (flat extrapolation).

Parameters
xValue to evaluate the table at
xsBreak points (at least 2 entries, strictly increasing; use a pair of break points an epsilon apart to approximate a step change instead of a literal duplicate)
ysValues at each break point (same size as xs)
Returns
Interpolated (or boundary-clamped) value
Exceptions
std::runtime_errorif xs has fewer than 2 entries, xs and ys differ in length, or xs is not strictly increasing

◆ linear_interpolate_slope()

double linear_interpolate_slope ( double x,
const std::vector< double > & xs,
const std::vector< double > & ys )

Local slope dy/dx of the piecewise-linear table used by linear_interpolate.

Outside [xs.front(), xs.back()], the table is flat (see linear_interpolate), so the slope is 0 there. At an interior break point, the slope of the segment to its right is used.

Parameters
xValue to evaluate the slope at
xsBreak points (at least 2 entries, strictly increasing; use a pair of break points an epsilon apart to approximate a step change instead of a literal duplicate)
ysValues at each break point (same size as xs)
Returns
Local slope of the interpolated table at x
Exceptions
std::runtime_errorif xs has fewer than 2 entries, xs and ys differ in length, or xs is not strictly increasing