Fix compiler warnings for the modal element when compiled with autodiff
This branch fixes compilation warnings for the modal element when compiled with --enable-autodiff. Most unsigned integer definitions have been changed to signed integers. In addition to that, all explicit type casts, which were needed before to suppress compiler warnings, have been eliminated.