Theoretical Investigation of the Magnetic Structure and Ferroelectric Polarization of the Multiferroic Langasite Ba3NbFe3Si2O14