Automatically generated code for relativistic inhomogeneous cosmologies