function varargout=eval(Th,u,varargin)
  assert(fc_simesh.is_siMesh(Th))
  p = inputParser;
  p.addParamValue('local', false, @islogical ); 
  p.addParamValue('labels', [] );
  p.addParamValue('d', Th.d ); % kind of elementary mesh ( d-simplicial)
  p.parse(varargin{:});
  d=p.Results.d;assert( ismember(d,1:Th.d) ) 
  if isempty(p.Results.labels)
    [idx,labels]=Th.find(d);
  else
    labs=p.Results.labels;
    [idx,labels]=Th.find(d,labs);
    if length(labels)<length(labs)
      LD=setdiff(labs,labels);
      error('siMesh.eval: %d-simplex labels not found %s',d,num2str(LD))
    end
  end
  n=length(labels);
  if p.Results.local
    U=cell(1,n);
    for i=1:n
      U{i}=Th.sTh{idx(i)}.eval(u);
    end
    if n==1,U=U{1};end
  else
    U=zeros(Th.nq,1);
    for i=1:n
      U(Th.sTh{idx(i)}.toGlobal)=Th.sTh{idx(i)}.eval(u);
    end
  end
  varargout{1}=U;
  if nargout>=2,varargout{2}=idx;end
  if nargout==3,varargout{3}=labels;end
end
