#include "harten0.icc"
struct harten {
  Float operator() (const point& x) const {
    Float x0 = x[0]-a*t+c;
    Float shift = -2*floor((x0+1)/2);
    Float xs = x0 + shift;
    check_macro (xs >= -1 && xs <= 1, "invalid xs="<<xs);
    return a + b*h0 (point(xs));
  }
  harten (Float t1=0, Float a1=1, Float b1=0.5, Float c1=0):
    h0(b1*t1), t(t1), a(a1), b(b1), c(c1) {}
  Float M() const { Float pi = acos(-1.0); return sqr(pi)*b; }
  Float min() const { return a-b; }
  Float max() const { return a+b; }
protected:
  harten0 h0;
  Float t, a, b, c;
};
using u_init = harten;
using g = harten;
