SetToFunction for MultiTensorField

[size=medium]Dear All,
I’d like to set an initial condition for 3D velocity field (defined as a multitensor field in my code) as follows:

setToFunction(*u, u->getBoundingBox(), u_Initial);

and the function is defined as:

Array<T,3> u_Initial(plint iX, plint iY, plint iZ, Array<T,3> u_)
if (N->get(iX,iY,iZ)>=0.5 && iX<=nx/2){
return Array<T,3>((T) 1.0,(T)0.,(T)0.);
else if (N->get(iX,iY,iZ)>=0.5 && iX>nx/2){
return Array<T,3>((T) -1.0,(T)0.,(T)0.);
else {
return Array<T,3>((T) 0.,(T)0.,(T)0.);

My code compiles without error and run as well, but the desired initial velocity does not impose!
I’ll appreciate to give me a hand.