Context

This PR adds a notion of a simulation context, removing the need for singletons, and allowing much easier testing and future parallel computation.

Closes #567.

Feel free to edit and add more, @rwcarlsen.