www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregbdrydev/setupConstraint.m

    function bdev = setupConstraint(bdev,con,opts,sp,bp,fitstatus)
%SETUPCONSTRAINT set up constraint in boundary node
%
%
% bdev = setupConstraint(bdev,con,opts,sp,bp,fitstatus)

%  Copyright 2008 The MathWorks, Inc. and Ford Global Technologies, Inc.

% Set the name of the node
newName = dispname(con);
bdev = name( bdev, newName );

% Need to update the bdev with the new constraint
bdev = pSetConstraint( bdev, con );

% The special points & boundary points are now out of date
bdev.BoundaryPoints = [];
bdev.SpecialPoints = [];

if nargin==2
    % New fit options
    opts = getFitOptions(con,'all');
end
bdev = setFitOptions(bdev,'all',opts);

%
% Need to set the status of the boundary dev
%
F = pBdrydevStatusFlags( bdev );

% Check that we have all the options that we need
haveSpecialPointOptions  = ~isempty( bdev.SpecialPointOptions );
haveBoundaryPointOptions = ~isempty( bdev.BoundaryPointOptions );
haveConstraintFitOptions = ~isempty( bdev.ConstraintFitOptions );

if haveSpecialPointOptions,
    bdev.Status = F.CanFindSpecialPoints;
elseif haveBoundaryPointOptions,
    bdev.Status = F.CanFindBoundaryPoints;
elseif haveConstraintFitOptions,
    bdev.Status = F.CanFitConstraint;
else
    bdev.Status = uint8( 0 );
end

if nargin>3 && ~isempty(fitstatus)
    bdev = StoreStatus(bdev,con,fitstatus,sp,bp);
end

% Fix up the version stored at the end of the pointer
xregpointer( bdev );