path_LUKE_LOCAL

PURPOSE ^

SYNOPSIS ^

function dkepath = path_LUKE_LOCAL

DESCRIPTION ^

 This function sets the LUKE and packages path relative to the local directory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dkepath = path_LUKE_LOCAL
0002 %
0003 % This function sets the LUKE and packages path relative to the local directory
0004 %
0005 path_id = 'LOCAL';%Set here the name path parameters (user specific)
0006 %
0007 filename = ['PATH_',path_id,'.mat'];
0008 filepaths = which(filename,'-all');
0009 nn = length(filepaths);
0010 %
0011 kk = [];
0012 if strcmp(computer,'MAC') | strcmp(computer,'MACI') |  strcmp(computer,'MACI64') | strcmp(computer,'PCWIN') | strcmp(computer,'PCWIN64'),%Systems which are usually not case sensitive
0013     for ii = 1:nn-1,
0014         for jj = ii+1:nn
0015             if strcmpi(filepaths{ii},filepaths{jj}),%identify identical strings (not case sensitive)
0016                 kk = [kk,jj];
0017             end
0018         end
0019     end
0020 %
0021     if ~isempty(kk),
0022         filepaths_new{1} = filepaths{1};%The first path is always kept
0023         mm = 2;
0024         for ii = 2:nn
0025             flag = 0;
0026             for jj = 1:length(kk)
0027                 if ii == kk(jj),flag = 1;end
0028             end
0029             if flag == 0,
0030                 filepaths_new{mm} = filepaths{ii};
0031                 mm = mm + 1;
0032             end
0033         end
0034         filepaths = filepaths_new;
0035         nn = length(filepaths);   
0036     end
0037 end
0038 %
0039 if nn > 0,
0040     if nn == 1,
0041         isel = 1;
0042     else
0043         disp('----> Please select one of the following :');
0044         for in = 1:nn,
0045             disp(['(',num2str(in),') : ',filepaths{in}]);
0046         end
0047         isel = input('? [1] ');
0048         if isempty(isel) | ~isnumeric(isel) | isel > nn,
0049             isel = 1;
0050         end
0051     end
0052     %
0053     filepath = filepaths{isel};
0054     %
0055     load(filepath,'dkepath'); 
0056     disp([filepath,' has been loaded'])
0057     return
0058 end   
0059 %
0060 if strfind(computer,'PCWIN'),    
0061     delim = '\';
0062     pathdelim = ';';
0063 else
0064     delim = '/';
0065     pathdelim = ':';
0066 end
0067 %
0068 curr_dir = [which('path_LUKE_LOCAL.m'),delim];
0069 %
0070 lukestr = [delim,'LUKE'];
0071 %
0072 ind_LUKE_dir = max(strfind(curr_dir,lukestr));
0073 %
0074 ind_root = min(find(curr_dir(ind_LUKE_dir+1:end) == delim));
0075 %
0076 path_root = curr_dir(1:ind_LUKE_dir + ind_root - 1);
0077 path_root = [path_root,delim];
0078 %
0079 filename = [path_root,'Project_DKE',delim,'Database',delim,'PATH_files',delim,filename];
0080 %
0081 disp([filename,' was not found and is created now.'])
0082 %
0083 dkepath.path_id = path_id;
0084 dkepath.computer = computer;%machine type and supported OS
0085 dkepath.luke_root = path_root;
0086 %
0087 uisetpath_flag = '';
0088 %
0089 while ~(ischar(uisetpath_flag) & (strcmp(uisetpath_flag,'y') | strcmp(uisetpath_flag,'n'))),
0090     %
0091     uisetpath_flag  = input_dke_yp('Do you want to build PATH_LOCAL.mat interactively? [y,n] ','y'); 
0092     %
0093 end
0094 %
0095 if uisetpath_flag == 'n',
0096     dkepath.temppathroot = '';%Absolute root directory path adress where temporary matrices are stored (empty: local directory)
0097     dkepath.local_root = path_root;
0098 else
0099     %
0100     disp('Press cancel to skip any path setting.')
0101     %
0102     if exist('/scratch/','dir'),
0103         initdir = '/scratch/';
0104     elseif exist('/tmp/','dir'),
0105         initdir = '/tmp/';
0106     else 
0107         initdir = '';
0108     end
0109     %
0110     temppathroot = uigetdir(initdir,'Select Temporary Directory');%Absolute root directory path adress where temporary matrices are stored (empty: local directory)
0111     if temppathroot ~= 0,
0112         dkepath.temppathroot = [temppathroot,'/'];
0113     else
0114         dkepath.temppathroot = '';
0115     end
0116     %
0117     initdir = [path_root,'Packages/'];
0118     %
0119     local_root = uigetdir(initdir,'Select External Packages Directory');%Absolute root directory path adress where temporary matrices are stored (empty: local directory)
0120     if local_root ~= 0,
0121         dkepath.local_root = [local_root,'/'];
0122     else
0123         dkepath.local_root = path_root;
0124     end
0125     %
0126     initdir = dkepath.local_root;
0127     %
0128     MUMPS_par = uigetdir(initdir,'Select Parallel MUMPS directory: "dke"');%Where MUMPS matrix solver is stored (stand-alone application for parallel processing)
0129     MUMPS_seq = uigetdir(initdir,'Select Sequential MUMPS directory: "dke"');%Where MUMPS matrix solver is stored (stand-alone application for sequential processing)
0130     MUMPS_mex = uigetdir(initdir,'Select Mex MUMPS directory: "MATLAB"');%Where MUMPS matrix solver is stored (stand-alone application for MEX processing)
0131     %
0132     MUMPS_mpi = uigetdir('/','Select mpi directory for MUMPS: "bin". Cancel to use system path.');%Absolute path to the correct mpirun or mpiexec (may depend of the architecture and the program). Leave empty is default system path is used
0133     %
0134     PETSc_par = uigetdir(initdir,'Select Parallel PETSc directory: "DKE"');%Where PETSc matrix solver is stored (stand-alone application for parallel processing)
0135     PETSc_seq = uigetdir(initdir,'Select Sequential PETSc directory: "DKE"');%Where PETSc matrix solver is stored (stand-alone application for sequential processing)
0136     PETSc_mex = uigetdir(initdir,'Select Mex PETSc directory: "MATLAB"');%Where PETSc matrix solver is stored (stand-alone application for MEX processing)
0137     %
0138     PETSc_mpi = uigetdir('/','Select mpi directory for PETSc: "bin". Cancel to use system path.');%Absolute path to the correct mpirun or mpiexec (may depend of the architecture and the program). Leave empty is default system path is used
0139     %
0140     SUPERLU_mex = uigetdir(initdir,'Select Mex SUPERLU directory: "MATLAB"');%Where SUPERLU matrix solver is stored (stand-alone application for MEX processing)
0141     %
0142     if MUMPS_par ~= 0,
0143         dkepath.MUMPS.par = MUMPS_par;
0144     end
0145     if MUMPS_seq ~= 0,
0146         dkepath.MUMPS.seq = MUMPS_seq;
0147     end
0148     if MUMPS_mex ~= 0,
0149         dkepath.MUMPS.mex = MUMPS_mex;
0150     end
0151     if MUMPS_mpi ~= 0,
0152         dkepath.MUMPS.mpipath = [MUMPS_mpi,'/'];
0153     else
0154         dkepath.MUMPS.mpipath = '';
0155     end
0156     if PETSc_par ~= 0,
0157         dkepath.PETSc.par = PETSc_par;
0158     end
0159     if PETSc_seq ~= 0,
0160         dkepath.PETSc.seq = PETSc_seq;
0161     end
0162     if PETSc_mex ~= 0,
0163         dkepath.PETSc.mex = PETSc_mex;
0164     end
0165     if PETSc_mpi ~= 0,
0166         dkepath.PETSc.mpipath = [PETSc_mpi,'/'];
0167     else
0168         dkepath.PETSc.mpipath = '';
0169     end
0170     if SUPERLU_mex ~= 0,
0171         dkepath.SUPERLU.mex = SUPERLU_mex;
0172     end
0173     %
0174     uisetpath_flag  = input('Please provide the arguments for the HELMEX compilation (type n to abandon helmex compilation): ','s');
0175     %
0176     if ischar(uisetpath_flag) | ~strcmp(uisetpath_flag,'n'),
0177         dkepath.compiler_opt.helmex = uisetpath_flag;
0178     end
0179     %
0180     save(filename,'dkepath');
0181     disp([filename,' is created.'])
0182     disp('The path file PATH_LOCAL.mat can be interactively rebuilt with the function path_LUKE_LOCAL.m')
0183     %
0184 end
0185

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