Code covered by the BSD License  

Highlights from
Huygens-Fresnel integral approximation, free-form apertures and rough surfaces

image thumbnail

Huygens-Fresnel integral approximation, free-form apertures and rough surfaces

by

 

Simulate wave propagation through free-form apertures, or off rough surfaces.

displayMessage(level, msg)
function displayMessage(level, msg)
% displayMessage - diplay time, runtime and a message string; depending on
% 'debuglevel' display the message as text, warning or error 
%
% level ... number of tab stops to insert, priority of msf
% msg ..... message to display

global debugLevel;
global tStart;

if isempty(tStart)
	error('ERROR: no timer variable ''tStart'' found - call createOptions');
end

% runtime
sec = toc(tStart);

% runtime in human readable format
h = floor(sec / 3600);
m = floor((sec - h*3600) / 60);
s = sec - h * 3600 - m * 60;

% timestamp
runtime = [' (runtime ' num2str(h,'%02u') ':' num2str(m,'%02u') ':' num2str(s,'%02.0f') '.' num2str(floor(1000*(s-floor(s))),'%03u') ')'];

if level > 0						% normal text messages with priorities
	% tab stops
	for k = 0 : level-1
		msg = ['  ' msg];
	end
	disp([datestr(now,13), runtime ': ', msg]);
else								% error, warning or plain text
	level = level + debugLevel;
	if level < 0
		error([datestr(now,13), runtime ': ', msg]);
	elseif level == 0
		warning([datestr(now,13), runtime ': ', msg]);
	else
		disp([datestr(now,13), runtime ': ', msg]);
	end
end

Contact us