[go: up one dir, main page]

Menu

[r4]: / coco / toolbox / coco / coco.m  Maximize  Restore  History

Download this file

71 lines (59 with data), 2.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function [varargout] = coco(varargin)
%COCO Top-level entry point to continuation toolboxes.
%
% BD = COCO(TOOLBOX, NAME, RUN, IST, ST, ...)
% BD = COCO(OPTS, TOOLBOX, NAME, RUN, IST, ST, ...) is the main wrapper
% for the continuation package. This call initiates the continuation of
% solutions of a type as defined by TOOLBOX. NAME is the name of the
% problem, typically the name of an m-file or a function handle for a
% system of equations or an ODE. RUN is a unique name assigned to the
% results produced during the continuation. IST specifies the type of the
% initial solution and ST the type of solutions to be continued from the
% starting point of type IST. COCO initialises an options structure used
% by all continuation toolboses and some variables and then calls the
% entry function to TOOLBOX. The name of this function is defined as
% SPRINTF('%s_%s2%s',TOOLBOX,IST,ST). All remaining arguments after ST
% are passed to this entry function. The optional first argument OPTS is
% an options structure created with coco_set. This argument allows to
% adjust the behaviour of the algorithms.
%
% See also: coco_set
%
current_spparms = spparms();
spparms('umfpack', 0);
opts = coco_set_defaults();
argidx = 1;
if isstruct(varargin{argidx})
opts = coco_set(opts, varargin{argidx});
argidx = argidx + 1;
end
Toolbox = varargin{argidx };
FName = varargin{argidx+1};
run = varargin{argidx+2};
from_st = varargin{argidx+3};
to_st = varargin{argidx+4};
if (exist(FName, 'file') == 2) || (exist(FName, 'file') == 3)
data_dir = sprintf('data/%s/%s', FName, run);
if ~ exist(data_dir, 'dir')
[s,msg,msgid]=mkdir(data_dir);
end
if ~ exist(data_dir, 'dir')
disp(msg);
error('%s: could not create directory ''%s''', ...
mfilename, data_dir);
end
delete([data_dir '/*']);
else
error('%s: file ''%s.m'' not found', mfilename, FName);
end
opts = coco_set(opts, 'toolbox', 'name', Toolbox);
opts = coco_set(opts, 'run', 'run', run );
opts = coco_set(opts, 'run', 'mfname', FName );
opts = coco_set(opts, 'run', 'dir', data_dir );
opts = coco_set(opts, 'run', 'bdfname', [data_dir '/bd']);
opts = coco_set(opts, 'run', 'isol_type', from_st );
opts = coco_set(opts, 'run', 'sol_type', to_st );
cfname = sprintf('%s_%s2%s', Toolbox, from_st, to_st);
cfhan = str2func(cfname);
[varargout{1:nargout}] = cfhan(opts, varargin{argidx+5:end});
spparms(current_spparms);