diff --git a/matlab/RunOpenEMS.m b/matlab/RunOpenEMS.m index 0e2140a..50b724f 100644 --- a/matlab/RunOpenEMS.m +++ b/matlab/RunOpenEMS.m @@ -8,12 +8,13 @@ function RunOpenEMS(Sim_Path, Sim_File, opts, Settings) % Sim_File = 'helix.xml'; %should be created by WriteOpenEMS % opts = '--engine=fastest'; % -% optinal: +% optional: % (ssh only on unix with working ssh client) % Settings.SSH.host = '' % Settings.SSH.bin = '/openEMS.sh' % % Settings.LogFile = 'openEMS.log' +% Settings.Silent = 0 % % RunOpenEMS(Sim_Path,Sim_File,opts,Settings) % @@ -57,13 +58,13 @@ if (isfield(Settings,'SSH') && isunix) else append_unix = []; end - status = unix(['ssh ' Settings.SSH.host ' "cd /tmp/' ssh_work_path ' && ' Settings.SSH.bin ' ' Sim_File ' ' opts '"' append_unix]) + status = unix(['ssh ' Settings.SSH.host ' "cd /tmp/' ssh_work_path ' && ' Settings.SSH.bin ' ' Sim_File ' ' opts '"' append_unix]); if (status~=0) disp(result); error('openEMS:RunOpenEMS','ssh openEMS failed!'); end - disp(['Remote simulation done... copying back results and cleaning up...']); + disp( 'Remote simulation done... copying back results and cleaning up...' ); [stat, res] = unix(['scp -r ' Settings.SSH.host ':/tmp/' ssh_work_path '/* ' pwd '/']); if (stat~=0); @@ -78,8 +79,12 @@ if (isfield(Settings,'SSH') && isunix) end else args = [Sim_File ' ' opts]; - if isfield(Settings,'LogFile') + if isfield(Settings,'LogFile') && isfield(Settings,'Silent') + invoke_openEMS(args,Settings.LogFile,Settings.Silent); + elseif isfield(Settings,'LogFile') invoke_openEMS(args,Settings.LogFile); + elseif isfield(Settings,'Silent') + invoke_openEMS(args,[],Settings.Silent); else invoke_openEMS(args); end diff --git a/matlab/invoke_openEMS.m b/matlab/invoke_openEMS.m index 5672d20..0d74bd2 100644 --- a/matlab/invoke_openEMS.m +++ b/matlab/invoke_openEMS.m @@ -1,5 +1,5 @@ -function invoke_openEMS( opts , logfile) -% function invoke_openEMS( opts ) +function invoke_openEMS( opts, logfile, silent ) +% function invoke_openEMS( opts, logfile, silent ) % % internal method to invoke openEMS, use RunOpenEMS instead % @@ -12,6 +12,16 @@ function invoke_openEMS( opts , logfile) if nargin < 1 error 'specify the xml file to simulate' end +if nargin < 3 + silent = 0; +end +if (nargin < 2) || isempty(logfile) + if isunix + logfile = '/dev/null'; + else + logfile = 'nul:'; + end +end % opts = [opts ' --disable-dumps']; % opts = [opts ' --debug-material']; @@ -31,8 +41,12 @@ end command = [openEMS_Path ' ' opts]; -if (isunix && nargin>1) - command = [command ' 2>&1 | tee ' logfile]; +if ~silent + if (isunix && nargin>1) + command = [command ' 2>&1 | tee ' logfile]; + end +else + command = [command ' > ' logfile ' 2>&1']; end disp( ['invoking openEMS simulator: ' command] );