Bears captain Ed Barnard scored an unbeaten century to lead Warwickshire to a strong position at the end of day one.