Use std::shared_ptr and std::weak_ptr to keep track of PETSc DMs.

This way we can re-use DMs allocated earlier (if possible), so that we
optimize RAM use by keeping only one DM for a given (dof,stencil_width)
combination *AND* de-allocate a DM as soon as it is not used any more.

The DM reuse part is not new; the de-allocation is. This is *not* an
important change, but it is much cleaner, plus #132 is taken care of
now. (Previously PISM had no way of telling if a DM is still needed or
not.)

All tests pass, the Python bindings work (the interface file is a
bit cleaner, too), but I discovered that some scripts in
examples/inverse are out of date.