2010-07-20 09:38:06 +00:00
|
|
|
function invoke_openEMS( opts, logfile, silent )
|
|
|
|
% function invoke_openEMS( opts, logfile, silent )
|
2010-06-09 07:22:54 +00:00
|
|
|
%
|
|
|
|
% internal method to invoke openEMS, use RunOpenEMS instead
|
|
|
|
%
|
|
|
|
% See also RunOpenEMS
|
|
|
|
%
|
|
|
|
% openEMS matlab interface
|
|
|
|
% -----------------------
|
|
|
|
% author: Sebastian Held
|
2010-05-03 20:09:40 +00:00
|
|
|
|
|
|
|
if nargin < 1
|
|
|
|
error 'specify the xml file to simulate'
|
|
|
|
end
|
2010-07-20 09:38:06 +00:00
|
|
|
if nargin < 3
|
|
|
|
silent = 0;
|
|
|
|
end
|
|
|
|
if (nargin < 2) || isempty(logfile)
|
|
|
|
if isunix
|
|
|
|
logfile = '/dev/null';
|
|
|
|
else
|
|
|
|
logfile = 'nul:';
|
|
|
|
end
|
|
|
|
end
|
2010-05-03 20:09:40 +00:00
|
|
|
|
|
|
|
% opts = [opts ' --disable-dumps'];
|
|
|
|
% opts = [opts ' --debug-material'];
|
|
|
|
% opts = [opts ' --debug-boxes'];
|
|
|
|
% opts = [opts ' --engine=sse'];
|
|
|
|
% opts = [opts ' --engine=multithreaded'];
|
|
|
|
|
|
|
|
filename = mfilename('fullpath');
|
|
|
|
dir = fileparts( filename );
|
2012-11-16 20:44:46 +00:00
|
|
|
|
2010-05-03 20:09:40 +00:00
|
|
|
if isunix
|
2013-09-04 09:18:17 +00:00
|
|
|
% <openEMS-path> could be /usr or ~/opt/openEMS etc.
|
|
|
|
% assume this file to be in '<openEMS-path>/share/openEMS/matlab/private/'
|
|
|
|
% assume openEMS binary to be in '<openEMS-path>/bin'
|
|
|
|
openEMS_Path = [dir filesep '../../../../bin' filesep];
|
2012-11-16 20:44:46 +00:00
|
|
|
openEMS_Path = [openEMS_Path 'openEMS.sh'];
|
2010-05-03 20:09:40 +00:00
|
|
|
else
|
2013-09-04 09:18:17 +00:00
|
|
|
openEMS_Path = [dir filesep '../..' filesep];
|
2012-11-16 20:44:46 +00:00
|
|
|
openEMS_Path = [openEMS_Path 'openEMS'];
|
2010-05-03 20:09:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
command = [openEMS_Path ' ' opts];
|
2010-06-21 10:17:19 +00:00
|
|
|
|
2010-07-20 09:38:06 +00:00
|
|
|
if ~silent
|
|
|
|
if (isunix && nargin>1)
|
|
|
|
command = [command ' 2>&1 | tee ' logfile];
|
|
|
|
end
|
|
|
|
else
|
|
|
|
command = [command ' > ' logfile ' 2>&1'];
|
2010-06-21 10:17:19 +00:00
|
|
|
end
|
|
|
|
|
2012-01-17 10:33:33 +00:00
|
|
|
% if ~silent
|
|
|
|
% disp( ['invoking openEMS simulator: ' command] );
|
|
|
|
% end
|
2010-05-03 20:09:40 +00:00
|
|
|
system(command);
|