A generalised algorithm for anelastic processes in elastoplasticity and biomechanics