Feature/scalar tests

Added a test for the scalar example, that verifies that it reproduces (approximately) the theoretically expected convergence order.
Also modified the scalar example, so that it fits into the testing framework.
So far, only up to six Lobatto nodes are tested.

Also, the MATCHER used in EXPECT_THAT is a pretty ugly construction and one can probably using something that is much more clever.

It might be a good idea to make a scalar
unit test where SDC should get the correct answer
up to machine precision.

Like y'=p'(t) for a polynomial p
or fancier
y'=m*y/(t-1)
which has solution
y=(t-1)^m

M


On 8/7/2014 5:38 AM, Daniel Ruprecht wrote:
>
> In tests/examples/scalar/test_scalar.cpp:
>
> > +      dt = Tend/double(nsteps[i]);
> > +      err[i] = run_scalar_sdc(nsteps[i], dt, nnodes, niters, lambda);
> > +    }
> > +
> > +    for (int i = 0; i<=nsteps_l-2; ++i)
> > +    {
> > +      convrate[i] = log10(err[i+1]/err[i])/log10(double(nsteps[i])/double(nsteps[i+1]));
> > +      // The expected convergence rate for Lobatto nodes is 2*nnodes-2, but because
> > +      // it will typically be not matched exactly, put in a security factor
> > +      expected_cr[i] = 0.9*double(2*nnodes-2);
> > +    }
> > +
> > +    // NOTE: There is probably a much more elegant way to test this, because
> > +    // expected_cr contains the same value in all entries. But I could not so far figure
> > +    // out how to build a more clever MATCHER here so far....
> > +    EXPECT_THAT(convrate, testing::Pointwise(DoubleMore(), expected_cr ));
>
> Instead of the hard-coded safety factor, you mean?
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/Parallel-in-Time/PFASST/pull/64/files#r15932535>.
>