Computational Gradient Elasticity and Gradient Plasticity with Adaptive Splines