Added ScalarFunction template, working on mesh