Changeset 6096
- Timestamp:
- 09/30/10 07:59:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/runsteps.m
r6076 r6096 8 8 % rs = runsteps('../Models/'); %build an empty runsteps object with a given repository 9 9 % rs = runsteps('../Models/','models.AGU.'); %build an empty runsteps object with a given repository and a prefix 10 % rs = runsteps('../Models/','models.AGU.','model.init'); %repository, prefix, and initial trunk prefix 10 11 11 12 classdef runsteps 12 13 properties (SetAccess=public) 13 14 % {{{1 14 repository='./'; 15 prefix ='model.'; 16 steps =[]; 15 repository ='./'; 16 prefix ='model.'; 17 trunkprefix =''; 18 steps =[]; 17 19 %}}} 18 20 end 19 21 methods 20 22 function rs=runsteps(varargin) % {{{1 21 if nargin> 2,23 if nargin>3, 22 24 help runsteps 23 25 error('runsteps constructor error message: bad usage'); 26 end 27 if nargin>2, 28 trunkprefix=varargin{3}; 29 if ~ischar(trunkprefix), error('trunkprefix is not a string'); end 30 if ~strcmp(regexprep(trunkprefix,'\s+',''),trunkprefix), error('trunkprefix should not have any white space'); end 31 rs.trunkprefix=trunkprefix; 24 32 end 25 33 if nargin>1, … … 96 104 function md=loadmodel(rs,string),% {{{1 97 105 98 % Some checks106 %Get model path 99 107 if ~ischar(string), error('argument provided is not a string'); end 100 101 %Get model path 102 id=GetId(rs,string); 103 path=[rs.repository '/' rs.prefix rs.steps(id).string]; 108 path=[rs.repository '/' rs.prefix string]; 104 109 105 110 %figure out if the model is there, otherwise, we have to use the default path supplied by user. 106 if ~exist(path,'file'), error(['File ' path ' not found']); end 107 md=loadmodel(path); 111 if exist(path,'file'), 112 md=loadmodel(path); 113 return; 114 end 115 116 %If we are here, the model has not been found. Try trunk prefix if provided 117 if ~isempty(rs.trunkprefix), 118 path2=[rs.repository '/' rs.trunkprefix string]; 119 if ~exist(path2,'file'), 120 error(['Could neither find ' path ', nor ' path2]); 121 else 122 disp(['--> Branching ' rs.prefix ' from trunk ' rs.trunkprefix]); 123 md=loadmodel(path2); 124 return; 125 end 126 else 127 error(['Could not find ' path ]); 128 end 108 129 end%}}} 109 130 function message(rs,num) % {{{1
Note:
See TracChangeset
for help on using the changeset viewer.