The return value of this function is not actually a tensor (in the sense that it doesn't transform like a tensor under coordinate rotations). It would probably be better if you used std_cxx1x::array<double,dim> as the data type -- in essence, an array of size 'dim' of doubles. The internal representation of this is of course exactly what Tensor<1,dim> does, but it has different semantics.

The argument is actually a point, so use Point<dim> as argument.

Finally: the function does not depend on any member variable. Can you make it 'static' (and you will have to remove the 'const' in that case at the end of the declaration)?