Analytical calculation of the 3D magnetostatic field of a toroidal conductor with rectangular cross section