Improvements to the management of the hazard curves

Now the hazard curves by realization are generated in the save_hazard_curves method, not in task_completed.
Moreover the relation between the realizations and the tectonic region types has been encoded in the database.
The improvements in speed and memory consumption in task_completed are substantial (two orders of magnitude for SHARE-like computations).
Tests are running: https://ci.openquake.org/job/zdevel_oq-engine/385