Index: /issm/trunk/src/m/classes/@runsteps/GetId.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/GetId.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/GetId.m	(revision 3184)
@@ -0,0 +1,15 @@
+function id=GetId(rs,message);
+%GetId - get step id from message
+%
+%   Usage:
+%      GetId(rs,num)
+
+for i=1:length(rs.steps),
+	if strcmp(rs.steps(i).message,message),
+		id=i;
+		return;
+	end
+end
+
+%If we are here, no step with given message has been found
+error(['runsteps error messge: no step with message ''' message ''' has been found ']);
Index: /issm/trunk/src/m/classes/@runsteps/addstep.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/addstep.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/addstep.m	(revision 3184)
@@ -0,0 +1,16 @@
+function rs = addstep(rs,message),
+%ADDSTEP - add ste p to runsteps object
+%
+%   Usage:
+%      rs = addstep(rs,message),
+%
+%   Examples:
+%      rs = addstep(rs,'new step (diagnostic)');
+
+%check message
+if ~ischar(message),
+	error('addstep error message: message provided should be a string');
+end
+
+rs.steps(end+1).id=length(rs.steps)+1;
+rs.steps(end).message=message;
Index: /issm/trunk/src/m/classes/@runsteps/display.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/display.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/display.m	(revision 3184)
@@ -0,0 +1,17 @@
+function display(rs)
+%DISPLAY - displays the fields of a runsteps element
+%
+%   echo function for 'runsteps' class
+
+disp(sprintf('\n%s = \n',inputname(1)));
+disp(sprintf('   Repository: ''%s''',rs.repository));
+disp(sprintf('   Prefix:     ''%s''',rs.prefix));
+if isempty(rs.steps)
+	disp('   no step');
+else
+	for i=1:length(rs.steps),
+		disp(sprintf('   step #%i',i));
+		disp(sprintf('      id:      %i',      rs.steps(i).id));
+		disp(sprintf('      message: ''%s''\n',rs.steps(i).message));
+	end
+end
Index: /issm/trunk/src/m/classes/@runsteps/loadmodel.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/loadmodel.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/loadmodel.m	(revision 3184)
@@ -0,0 +1,39 @@
+function md=loadmodel(rs,step,varargin),
+%LOADMODEL - save model for a given step
+%
+%   Usage:
+%      md=loadmodel(rs,num,varargin)
+%
+%   Examples:
+%      md=loadmodel(rs,num)
+%      md=loadmodel(rs,num,'2d')
+
+%check inputs
+if (nargin<2 | nargin>3),
+	help loamodel
+	error('loadmodel error message: bad usage');
+end
+
+%Get id
+if ischar(step),
+	id=GetId(rs,step);
+else
+	id=step;
+end
+
+%check rs length
+if (id>length(rs.steps)),
+	error(['runsteps error message: element with id ' num2str(num) ' not found']);
+end
+
+%get type if provided
+if nargin~=3
+	path=[rs.repository '/' rs.prefix num2str(id)];
+elseif ischar(varargin{1}),
+	path=[rs.repository '/' rs.prefix num2str(id) '.' varargin{1} ];
+else
+	error('loadmodel error message: third argument should be a string');
+end
+
+%load model
+md=loadmodel(path);
Index: /issm/trunk/src/m/classes/@runsteps/message.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/message.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/message.m	(revision 3184)
@@ -0,0 +1,16 @@
+function message(rs,num);
+%MESSAGE - display message of rs with id =num
+%
+%   Usage:
+%      message(rs,num)
+
+%Some checks
+if (abs(floor(num))~=num),
+	error(['runsteps error message: the number provided is not a positive integer']);
+end
+if (num>length(rs.steps)),
+	error(['runsteps error message: element with id ' num2str(num) ' not found']);
+end
+
+%Print message
+disp(sprintf('\n   step #%i -> %s\n',rs.steps(num).id,rs.steps(num).message));
Index: /issm/trunk/src/m/classes/@runsteps/runsteps.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/runsteps.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/runsteps.m	(revision 3184)
@@ -0,0 +1,46 @@
+function rs = runsteps(varargin),
+%RUNSTEPS - constructor for runsteps object
+%
+%   Usage:
+%      rs = runsteps(varargin)
+%
+%   Examples:
+%      rs = runsteps;                             %build an empty runsteps object
+%      rs = runsteps('../Models/');               %build an empty runsteps object with a given repository
+%      rs = runsteps('../Models/','models.AGU.'); %build an empty runsteps object with a given repository and a prefix
+
+if (nargin==0),
+
+	rs.repository='./';
+	rs.prefix    ='model.step#';
+	rs.steps     =[];
+	rs=class(rs,'runsteps');
+
+elseif (nargin==1 & ischar(varargin{1})),
+
+	%Check repository
+	if exist(varargin{1},'dir')~=7,
+		error(['runsteps constructor error message: repository ' varargin{1} ' is not a directory']),
+	end
+	rs.repository=varargin{1};
+	rs.prefix    ='model.step#';
+	rs.steps     =[];
+	rs=class(rs,'runsteps');
+
+elseif (nargin==2 & ischar(varargin{1}) & ischar(varargin{2})),
+
+	%Check repository
+	if exist(varargin{1},'dir')~=7,
+		error(['runsteps constructor error message: repository ' varargin{1} ' is not a directory']),
+	end
+	rs.repository=varargin{1};
+	rs.prefix    =varargin{2};
+	rs.steps     =[];
+	rs=class(rs,'runsteps');
+
+else
+
+	help runsteps
+	error('runsteps constructor error message: bad usage')
+
+end
Index: /issm/trunk/src/m/classes/@runsteps/savemodel.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/savemodel.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/savemodel.m	(revision 3184)
@@ -0,0 +1,40 @@
+function savemodel(rs,num,varargin),
+%SAVEMODEL - save model for a given step
+%
+%   Usage:
+%      savemodel(rs,num,md)
+%
+%   Examples:
+%      savemodel(rs,num,md)
+%      savemodel(rs,num,'2d',md)
+
+%check inputs
+if nargin==3 
+	md=varargin{1};
+elseif nargin==4
+	type=varargin{1};
+	md=varargin{2};
+else
+	help loamodel
+	error('savemodel error message: bad usage');
+end
+
+%check that md is a model
+if ~isa(md,'model'),
+	error('savemodel error message: third argument is not a model')
+end
+
+%check rs length
+if (num>length(rs.steps)),
+	error(['runsteps error message: element with id ' num2str(num) ' not found']);
+end
+
+%save model
+if nargin==3,
+	name=[rs.repository '/' rs.prefix num2str(num)];
+else
+	name=[rs.repository '/' rs.prefix num2str(num) '.' type];
+end
+
+save(name,'md');
+disp(['model saved as: ' name]);
Index: /issm/trunk/src/m/classes/@runsteps/subsasgn.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/subsasgn.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/subsasgn.m	(revision 3184)
@@ -0,0 +1,12 @@
+function rs = subsasgn(rs,index,val)
+%SUBSASGN - handle indexed assignments to runme objects
+%
+%   the first argument is the object, the second argument a structure array
+%   the third one is the value
+%
+%   Usage:
+%      rs = subsasgn(rs,index,val)
+%
+%   See also SUBSREF
+
+rs=builtin('subsasgn',rs,index,val);
Index: /issm/trunk/src/m/classes/@runsteps/subsref.m
===================================================================
--- /issm/trunk/src/m/classes/@runsteps/subsref.m	(revision 3184)
+++ /issm/trunk/src/m/classes/@runsteps/subsref.m	(revision 3184)
@@ -0,0 +1,10 @@
+function rs = subsref(rs,index)
+%SUBSREF - handles indexed references to objects
+%
+%   the first argument is the object and the second one a structure array
+%   Usage:
+%      rs = subsref(rs,index)
+% 
+%   See also SUBSASGN
+
+rs=builtin('subsref',rs,index);
