Forked from
agnumpde / dune-tectonic
1513 commits behind the upstream repository.
-
Elias Pipping authoredElias Pipping authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
properscalarincreasingconvexfunction.hh 962 B
/* -*- mode:c++; mode:semantic -*- */
#ifndef PROPER_SCALAR_INCREASING_CONVEX_FUNCTION_HH
#define PROPER_SCALAR_INCREASING_CONVEX_FUNCTION_HH
class ProperScalarIncreasingConvexFunction {
public:
virtual double operator()(const double s) const = 0;
virtual double leftDifferential(const double s) const = 0;
virtual double rightDifferential(const double s) const = 0;
};
class SampleFunction : public ProperScalarIncreasingConvexFunction {
public:
double operator()(const double s) const { return (s < 1) ? s : (2 * s - 1); }
double leftDifferential(const double s) const { return (s <= 1) ? 1 : 2; }
double rightDifferential(const double s) const { return (s < 1) ? 1 : 2; }
};
class TrivialFunction : public ProperScalarIncreasingConvexFunction {
public:
double operator()(const double) const { return 0; }
double leftDifferential(const double) const { return 0; }
double rightDifferential(const double) const { return 0; }
};
#endif