Learning from Demonstrations with the Finite Element Method