function [y,unit]=mphint(m,expr,varargin)
% MPHINT Perform integration of expressions
% 
%   VAL = MPHINT(MODEL,TYPE,{E1,E2,...,EN},...) evaluates the integrals of
%   the string expressions E1,E2,...,EN and returns the result in the 
%   matrix VAL with N rows and M columns. M is the length of the vector
%   SOLNUM.
%
%   [VAL UNIT]= MPHINT(MODEL,{E1,E2,...,EN},...) in addition returns the 
%   units of the integral in a nx1 cell array.
% 
%   Valid property/value pairs include:
%   Property     Value/{Default}               Description
%   -----------------------------------------------------------------------
%   Dataset       String {''}                  Data set tag
%   Edim          1, 2, or 3 {sdim}            Element dimension
%   Intorder      Positive integer {4}         Integration order
%   Intsurface    'on' | {'off'}               Compute surface integral
%   Intvolume     'on' | {'off'}               Compute volume integral
%   Matherr       {'off'} | 'on'               Error for undefined 
%                                              operation or expressions
%   Method        {'auto'} | 'integration' |   Integration method
%                 'summation'
%   Outersolnum   Positive integer {1}         Solution number for 
%                                              parametric sweep
%   Selection     Integer vector | {'all'}     Domain list
%   Solnum        Integer vector | 'end' |     Solution for evaluation
%                 {'all'}
%   T             Double array {''}            Time for evaluation
%   Unit          String {''} | Cell array     Unit of the integral 
%                                              expression
% 
%   The unit property defines the unit of the integral, if a unconsistent
%   unit is entered, the default unit is used.
%   In case of multiple expression, if the unit property is defined with a
%   string the same unit will be used for both expressions. To use 
%   different units, set the property with a cell array. In case of 
%   unconsistent unit definition, the default unit will be used instead.
%   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 MPHINT 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');
%     % Integrate the x-velocity u at the outlet boundary and get the unit:
%     [flow unit] = mphint(model,'u','edim',2,'selection',136);
%     % Return the value of the outlet flow in [mm^3/s]:
%     flow = mphint(model,'u','edim',2,'selection',136,'unit','mm^3/s');
% 
%   Example 2:
%     % Load heat_transient_axi.mph from the Model Library:
%     model = mphload('heat_transient_axi.mph');
%     % Integrate the normal heat flux along external boundaries using
%     % surface integration:
%     Q = mphint(model,'ht.ndflux','intsurface','on','edim',1,...
%       'selection',[2,3,4]);
%     % Integrate both the normal heat flux and the temperature and set  
%     % the unit to use ([MW] and [m^2*degC] respectively):
%     [Int unit] = mphint(model,{'ht.ndflux','T'},'intsurface','on',...
%       'edim',1,'selection',[2,3,4],'unit',{'MW','m^2*degC'});
% 
%   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;
%     % Integrate the variable u over the domain for the second value of r:
%     u_int = mphint(model,'u','dataset','dset2','outersolnum',2);

% Copyright 2010-2011 COMSOL
