function n=mphselectbox(model,geomname,coord,entity,varargin)
% MPHSELECTBOX Select geometric entity using a rubberband/box
% 
%   N = MPHSELECTBOX(MODEL,GEOMNAME,BOXCOORD,ENTITY,...) returns the 
%   indices of the geometric entities that are inside the rubberband domain
%   (rectangle or box). This method looks only on the vertex coordinates
%   and does not observe all points on curves and surfaces.
% 
%   BOXCOORD set the coordinates of the selection domain, specified as a 
%   Nx2 array, where N is the geometry space dimenion.
%   ENTITY can be one of 'point', 'edge', 'boundary' or 'domain'. See the
%   entry MPHSELECTBOX in the LiveLink for MATLAB User's Guide for more
%   information about the entity type definition.
% 
%   The following options are available:
%   Property    Value/{Default}       Description
%   -----------------------------------------------------------------------
%   Adjnumber   Scalar{[]}            Adjacent entity number
% 
%   When a model uses "form an assembly" more than one vertex may have the
%   same coordinate if the coordinate is shared be separate geometric
%   objects. In that case one can use the adjnumber property in order to 
%   identify the domain that the vertices should be adjacent to.
% 
%   Example 1:
%     % Load busbar.mph from the Model Library:
%     model = mphload('busbar.mph')
%     % Find domains that are inside the selection box defined by
%     % [0 0.05;0 -0.05;-0.05 0.05]:
%     n = mphselectbox(model,'geom1',[0 0.05;0 -0.05;-0.05 0.05],...
%       'domain');
%     % Find boundaries inside the selection box that are adjacent to
%     % domain number 1:
%     n = mphselectbox(model,'geom1',[0 0.05;0 -0.05;-0.05 0.05],...
%       'boundary','adjnumber',1);
% 
%   Example 2:
%     % Load effective_diffusivity.mph from the Model Library:
%     model = mphload('effective_diffusivity.mph');
%     % Find the boundaries that are inside the selection rectangle
%     % defined by [3e-4,4e-4;4.5e-4,5.5e-4]:
%     n = mphselectbox(model,'geom1',[3e-4 4e-4; 4.5e-4 5.5e-4],...
%       'boundary');
%     % Find the boundaries that are inside the same selection rectangle:
%     n = mphselectbox(model,'geom1',[3e-4 4e-4; 4.5e-4 5.5e-4],'point');
% 
%   See also: mphgetadj, mphgetcoords, mphselectcoords

% Copyright 2010-2011 COMSOL
