function pd=mpheval(m,expr,varargin)
% MPHEVAL Evaluate expressions on node points
% 
%   PD = MPHEVAL(MODEL,{e1,e2,...,en},...) returns the post data PD for the
%   expressions e1,e2,...,en.
% 
%   The value PD is post data, a structure with fields p, t, ve, expr, 
%   unit, the fields for data values. 
%   The field p contains node point coordinate information. The number of 
%   rows in p is the number of space dimensions. 
%   The field t contains the indices to columns in p of a simplex mesh, 
%   each column in t representing a simplex. 
%   The field ve contains indices to mesh elements for each node point. 
%   For each expression e1,e2,...,en a field with the name d1, d2,...,dn is 
%   added with the numerical values. The columns in the data value fields 
%   correspond to node point coordinates in columns in p.
%   The field expr contains the expression name evaluated.
%   The field unit contains the list of the unit for each expression.
%   The data contains the real part of complex-valued expressions.
% 
%   Valid property/value pairs include:
%   Property     Value/{Default}           Description
%   -----------------------------------------------------------------------
%   Complexfun   'off' | {'on'}            Use complex-valued functions 
%                                          with real input
%   Complexout    {'off'} | 'on'           Return complex values
%   Dataset      String {''}               Data set tag name
%   Edim         0, 1, 2, or 3 {sdim}      Evaluate on elements with this
%                                          space dimension
%   Matherr      'on' | {'off'}            Error for undefined operations
%                                          or expressions
%   Outersolnum  Positive integer {1}      Solution number for parametric
%                                          sweep
%   Pattern      {'lagrange'} | 'gauss'    Specifies if evaluation takes 
%                                          place in Lagrange points or in 
%                                          Gauss points.
%   Phase        Scalar {0}                Phase angle in degrees
%   Recover      {'off'} | 'ppr' |         Accurate derivative recovery
%                'pprint'
%   Refine       Integer {1}               Refinement of elements for 
%                                          evaluation points
%   Selection    Integer vector |          Domain selection list
%                {'all'}
%   Smooth       {Internal} | none |       Smoothing setting
%                everywhere
%   Solnum       Integer vector |          Solution for evaluation
%                'end' | {'all'}
%   T            Double array {''}         Time for evaluation
% 
%   Solnum is used to select the solution number when a parametric,
%   eigenvalue or time-dependent solver has been used.
%   Outersolnum is used to  select the outer solution number when a 
%   parametric sweep has been used in the study step node.
% 
%   See the entry MPHEVAL in the LiveLink for MATLAB User's Guide for more 
%   information about the property/values.
% 
%   Example 1:
%     % Load micromixer.mph from the Model Library:
%     model = mphload('micromixer.mph');  
%     % Evaluate the pressure at all node points:
%     dat = mpheval(model,'p');
%     % Evaluate the concentration at the oulet boundary:
%     dat = mpheval(model,'c','edim',2,'selection',136);
%     % Evaluate the pressure on all geometric vertices:
%     dat = mpheval(model,'p','edim',0);
%     % Evaluate the pressure on vertex number 1 and return only the p 
%     % data:
%     p = mpheval(model,'p','edim',0,'selection',1,'dataonly','on');
% 
%   Example 2:
%     % Load spherically_symmetric_transport.mph from the Model Library:
%     model = mphload('spherically_symmetric_transport.mph') ; 
%     % Evaluate the temperature T at node No 1 for interpolated time:
%     dat = mpheval(model,{'T','t'},'edim',0,'selection',1,'t',[0:0.3:6]);
%     plot(dat.d2,dat.d1)
% 
%   Example 3:
%   % Load model black_scholes_put.mph from the Model Library:
%   model = mphload('black_scholes_put.mph');
%   % Add a parametric sweep feature to the solver node and run the study:
%   param = model.study('std1').feature.create('param', 'Parametric');
%   param.set('pname', {'r'});
%   param.set('plist', 'range(0.12,0.12,0.6)');
%   model.study('std1').run;
%   % Evaluate the solution at t=6sec for the second  value of r:
%   dat = mpheval(model,'u','dataset','dset2','outersolnum',2,'t',6);
% 
%   See also: mphglobal, mphint, mphinterp

% Copyright 2010-2011 COMSOL
