Work on the classical damage calculator

This closes https://bugs.launchpad.net/oq-engine/+bug/1389161.
The tests are green: https://ci.openquake.org/job/zdevel_oq-risklib/157