Skip to content
Snippets Groups Projects
Commit d7f9ee7a authored by Antoine Merle's avatar Antoine Merle
Browse files

Keep results from previous machines in get_data_request_names_...

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@7608 d63d8f72-b253-0410-a779-e742ad2e26cf
parent e2cb9e05
No related branches found
No related tags found
No related merge requests found
...@@ -8,40 +8,38 @@ function [data_request_names] = get_data_request_names_from_gdat_xxx(machine_in) ...@@ -8,40 +8,38 @@ function [data_request_names] = get_data_request_names_from_gdat_xxx(machine_in)
data_request_names = []; data_request_names = [];
expected_machines = [{'aug'}, {'d3d'}, {'jet'}, {'tcv'}]; % substrutures created for these at this stage (all means all of these) expected_machines = [{'aug'}, {'d3d'}, {'jet'}, {'tcv'}]; % substrutures created for these at this stage (all means all of these)
for j=1:length(expected_machines) try machine_in = validatestring(machine_in,expected_machines);
data_request_names.(expected_machines{j}) = []; catch ME,
end disp(ME.message);
ij=strmatch(lower(machine_in),expected_machines); return;
if isempty(ij)
disp(['machine ' machine_in ' not expected in get_data_request_names_from_gdat_xxx'])
return
end end
machine_in = lower(machine_in);
% Avoid running this function over and over % Avoid running this function over and over
% This is another bottleneck in the gdat execution. % This is another bottleneck in the gdat execution.
persistent last_machine last_answer persistent last_answer
if ~isempty(last_machine) && strcmpi(last_machine,machine_in) if ~isempty(last_answer),
data_request_names = last_answer; data_request_names = last_answer;
return; if ~isempty(data_request_names.(machine_in)), return;end
else
for j=1:length(expected_machines)
data_request_names.(expected_machines{j}) = [];
end
end end
fid=fopen([machine_in '_requests_mapping.m'],'r'); fid=fopen([machine_in '_requests_mapping.m'],'r');
nextline=fgetl(fid); nextline=fgetl(fid);
keywds = [];
while isempty(nextline) || ~isnumeric(nextline) || nextline~=-1 %length(nextline)>2 || ~strcmp(nextline,'-1') while isempty(nextline) || ~isnumeric(nextline) || nextline~=-1 %length(nextline)>2 || ~strcmp(nextline,'-1')
if length(nextline)>7 && strcmp(nextline(1:6),' case ') if length(nextline)>7 && strcmp(nextline(1:6),' case ')
ij=find(nextline==['''']); ij=find(nextline==['''']);
if ~isempty(ij) if ~isempty(ij)
for i=1:2:length(ij)-1 for i=1:2:length(ij)-1
keywds_next = nextline(ij(i)+1:ij(i+1)-1); keywds_next = nextline(ij(i)+1:ij(i+1)-1);
i_backslash = find(keywds_next=='\'); i_backslash = find(keywds_next=='\', 1);
i_column = find(keywds_next==':'); i_column = find(keywds_next==':', 1);
if isempty(i_backslash) && isempty(i_column) if isempty(i_backslash) && isempty(i_column)
keywds{end+1} = keywds_next; data_request_names.(machine_in).(keywds_next) = keywds_next;
data_request_names.(machine_in).(keywds{end}) = keywds{end}; end
end
end end
end end
end end
...@@ -50,6 +48,5 @@ end ...@@ -50,6 +48,5 @@ end
fclose(fid); fclose(fid);
data_request_names.all = []; data_request_names.all = [];
last_machine = machine_in;
last_answer = data_request_names; last_answer = data_request_names;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment