Flow123d
JS_before_hm-1880-gdd969e4e2
|
Go to the documentation of this file.
18 #ifndef INTERPOLANT_IMPL_H
19 #define INTERPOLANT_IMPL_H
55 template<
template<
class>
class Func,
class Type >
58 interpolate_derivative(interpolate_derivative)
70 template<
template<
class>
class Func,
class Type >
210 return func->operator()(x);
274 double x_step = x /
step;
288 double x_step = x /
step;
307 inline double p() {
return p_;}
315 return std::pow(a,
p_);
333 inline double p() {
return p_;}
340 double a = std::abs(f.first - g.first) / (std::abs(f.first) +
tol_)
341 + std::abs(f.second - g.second) / (std::abs(f.second) +
tol_);
343 return std::pow(a,
p_);
356 template<
template<
class>
class Func,
class Type >
371 template<
template<
class>
class Func,
class Type >
374 interpolate_derivative(interpolate_derivative),
375 explicit_interpolant(NULL),
399 template<
class TType>
432 #endif //INTERPOLATION_IMPL_H
double val_test(double x)
Do NOT use, only for testing purpose.
double step
Chosen interpolation step.
EvalStatistics stats
Structure which keeps evaluation statistics. See InterpolantBase::eval_statistics.
double bound_a_
Left interval boundary.
double val(double u)
Returns interpolated value.
void set_functor(Func< Type > *func, bool interpolate_derivative=false)
Sets the implicit functor.
FunctorBase< T< double > > * func_diffn
Pointer to original functor with FADBAD T type.
double f_val(double x)
Returns value of the original functor.
std::vector< double > f_vec
Vector of function values at nodes.
double min
minimal x for which the evaluation was called outside the interval (initially is equal the left bound...
Interpolant()
Default constructor.
void set_functor(Func< Type > *func, bool interpolate_derivative=false)
Sets the functor.
Interpolant * interpolant
Interpolant * interpolant
std::vector< bool > checks
Vector of boolean values telling us which parameters are set or not.
FunctorBase< B< double > > * func_diff
Pointer to original functor with FADBAD B type.
unsigned int size_
Number of dividing intervals.
IFunctorBase< Type > * func_impl
bool interpolate_derivative
Is true if we want to interpolate the derivative too.
double a_div_step
bound_ divided by step - precomputed value for evaluation
The main class for interpolation of functors.
FunctorBase< double > * func
Pointer to original functor with double type.
Abstract templated implicit functor class.
double error_
Error of the interpolation.
FuncError_lp(Interpolant *interpolant, double p, double tol)
virtual double operator()(double x)
Virtual operator () with type Type.
unsigned int interval_miss_a
counts left misses of the interval
unsigned int interval_miss_b
counts right misses of the interval
unsigned int total_calls
counts total calls of evaluation
@ fix_x
x variable will be fixed with given value
@ no_fix
no variable is fixed (used when InterpolantImplicit is created)
FuncExplicit(IFunctorBase< TType > &func_impl, IFixVariable::Type fix, double fix_val)
std::vector< double > df_vec
Vector of function derivatives values at nodes.
Interpolant * explicit_interpolant
DiffValue diff_p1(double x)
Finds interval on which x lies.
Structure that keeps statistics of evaluation.
IFunctorBase< double > * func
double val_p1(double x)
Do NOT use, unless you are 100% sure.
@ fix_y
y variable will be fixed with given value
void set_param_from_func(FunctorCommon< TType > *func)
Sets a functor's parameters from another functor.
bool interpolate_derivative
Is true if we want to interpolate the derivative too.
std::pair< double, double > DiffValue
DiffValue diff(double x)
Returns interpolated value of the derivation.
DiffValue f_diff(double x)
Returns 1st derivative of original functor using FADBAD.
double bound_a() const
Returns left boundary of the interval.
FuncExplicit()
Constructor.
Extrapolation::Type extrapolation
double max
maximal x for which the evaluation was called outside the interval ((initially is equal the right bou...
virtual double operator()(double x)
Virtual operator () with type Type.
unsigned int size() const
Returns the size of the interpolation table.
Abstract templated explicit functor class.
IFunctorBase< T< double > > * func_diffn
double val(double x)
Returns interpolated value.
double bound_b() const
Returns right boundary of the interval.
double bound_b_
Right interval boundary.
InterpolantImplicit()
constructor
EvalStatistics statistics() const
Returns structure with evaluation statistics.
DiffValue diff(double u)
Returns interpolated value of the derivation.
IFunctorBase< B< double > > * func_diff
FuncError_wp1(Interpolant *interpolant, double p, double tol)
double error()
Returns error of the interpolation.