www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregbdrydev/loadobj.m
function bdev = loadobj(bdev) %LOADOBJ Load filter for boundary dev class (XREGBDRYDEV) % % BDEV = LOADOBJ(BDEV) % % See also XREGBDRYDEV % Copyright 2005 The MathWorks, Inc. if bdev.Version <= 1, % Upgarde from version 1 to version 2 structure. % % Version: 1 % Model: [] % BdryPoints: [] % LockedBdryPoints: [] % SpecialPoints: [] % LockedSpecialPoints: [] % xregbdrynode: [1x1 xregbdrynode] bdev.Constraint = bdev.Model; bdev.SpecialPointOptions = []; bdev.BoundaryPointOptions = []; bdev.ConstraintFitOptions = []; % Some constraints set the boundary points to ':' to indicate 'all'. % This needs to be changed into a vector of indices. if ischar( bdev.BdryPoints ) && strcmpi( ':', bdev.BdryPoints ), bdev.BoundaryPoints = []; hLoad = mbcloadrecorder( 'current' ); hLoad.add( {@i_SetAllBoundaryPoints, address( bdev.xregbdrynode )}, ... '14-Jul-2005' ); else bdev.BoundaryPoints = bdev.BdryPoints; end % Remove old fields no longer used. bdev = mv_rmfield( bdev, {'Model', 'BdryPoints', ... 'LockedBdryPoints', 'LockedSpecialPoints'} ); % Set the status F = pBdrydevStatusFlags( xregbdrydev ); if isempty( bdev.Constraint ), bdev.Status = uint8( 0 ); else con = bdev.Constraint; % The version 1 way of doing things did all fitting parts in one % step. Therefore, if there if there is a constraint it is % considered fitted and all parts of the fit process are available. bdev.Status = F.ConstraintFitted; if ~isempty( getspecialpointoptions( con ) ), bdev.Status = bdev.Status + F.CanFindSpecialPoints; end if ~isempty( getBoundaryPointOptions( con ) ), bdev.Status = bdev.Status + F.CanFindBoundaryPoints; end if ~isempty( getConstraintFitOptions( con ) ), bdev.Status = bdev.Status + F.CanFitConstraint; end end % Partial increment of the version number: bdev.Version = 2; end if isstruct( bdev ), % Convert the structure to an object. bdev = xregbdrydev( bdev ); end %-------------------------------------------------------------------------- function i_SetAllBoundaryPoints( pProject, evt, pBdev ) bdev = pBdev.info; % Get the data data = getdata( bdev ); nPts = size( data, 1 ); % Set the boundary indices bdev.BoundaryPoints = 1:nPts; % Update dynamic version xregpointer( bdev ); %-------------------------------------------------------------------------- % EOF %--------------------------------------------------------------------------