select_remote_profile_yp

PURPOSE ^

LUKE - Select a remote profile if available by a chain of char

SYNOPSIS ^

function remnum = select_remote_profile_yp(remprofile,dkepath)

DESCRIPTION ^

 LUKE - Select a remote profile if available by a chain of char 

    Select a remote profile if available by a chain of char 

    Input:

       - remprofile: chain of caracter that allows to identify the remote
       - dkepath: structure for the paths
           (default: if no input structure or empty, dkepath is automatically loaded from LUKE_PATH.mat)

    Output:

       - remnum : selected remote number [1,1]

 by Yves Peysson (CEA/DSM/IRFM, yves.peysson@cea.fr) and Joan Decker (CEA/DSM/IRFM, joan.decker@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function remnum = select_remote_profile_yp(remprofile,dkepath)
0002 % LUKE - Select a remote profile if available by a chain of char
0003 %
0004 %    Select a remote profile if available by a chain of char
0005 %
0006 %    Input:
0007 %
0008 %       - remprofile: chain of caracter that allows to identify the remote
0009 %       - dkepath: structure for the paths
0010 %           (default: if no input structure or empty, dkepath is automatically loaded from LUKE_PATH.mat)
0011 %
0012 %    Output:
0013 %
0014 %       - remnum : selected remote number [1,1]
0015 %
0016 % by Yves Peysson (CEA/DSM/IRFM, yves.peysson@cea.fr) and Joan Decker (CEA/DSM/IRFM, joan.decker@cea.fr)
0017 %
0018 if nargin == 0, 
0019     remprofile = '';
0020     dkepath = '';
0021 end
0022 %
0023 if nargin == 1, 
0024     dkepath = '';
0025 end
0026 %
0027 if isempty(dkepath) || ~isstruct(dkepath),
0028     dkepath = load_structures_yp('dkepath','','');
0029 end
0030 %
0031 if ~isempty(remprofile),
0032     %
0033     if strfind(remprofile,'local'),
0034          remnum = 0;%local calculation
0035     else
0036         %
0037         remlist = [];
0038         %
0039         for irem = 1:length(dkepath.remote),
0040             if strfind(dkepath.remote(irem).host,remprofile),
0041                 remlist = [remlist,irem];
0042             end
0043         end
0044         %
0045         if isempty(remlist),
0046             disp(['WARNING: no remote profile for ''',remprofile,'''']);
0047             disp(['---> Interactive choice enforced for choosing the remote profile']);
0048             remlist = [];
0049         end
0050         %
0051     end
0052 else
0053     remlist = [];
0054 end
0055 %
0056 if exist('remlist','var')
0057     %
0058     flag_remote = check_remote_yp(dkepath,remlist,0,'');
0059     %
0060     if ~isempty(find([1:length(flag_remote)].*flag_remote > 0)),
0061         if isempty(remlist), remlist = 1:length(flag_remote);end
0062         remnum = remlist(input_dke_yp('Please identify the profile to be used for the simulation.',find(remlist.*flag_remote > 0),find(remlist.*flag_remote > 0)));
0063     else
0064         remnum = 0;%local calculation
0065         disp('WARNING: Local calculation enforced.');
0066     end
0067 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.