Exact solution of an ekpyrotic fluid and a primordial magnetic field in an anisotropic cosmological space-time of Petrov D