Adaptive Discretization of Continuous-Time Inventory Control Problems and its Application to Production Planning and Smoothing