diff --git a/API/RAT.m b/API/RAT.m index 61a4c58cc..5d3c6c282 100644 --- a/API/RAT.m +++ b/API/RAT.m @@ -66,6 +66,12 @@ % Call the main RAT routine... display = ~strcmpi(controls.display, displayOptions.Off.value); textProgressBar(0, 0, display); +printFunc = @(x) fprintf("%s", x); +progressFunc = @(x) textProgressBar(x{1}, x{2}); + +eventManager.register(eventTypes.Message, printFunc); +eventManager.register(eventTypes.Progress, progressFunc); + % If display is not silent print a line confirming RAT is starting if display fprintf('Starting RAT ______________________________________________________________________________________________\n\n'); @@ -78,6 +84,9 @@ toc end textProgressBar(0, 0, true); +eventManager.unregister(eventTypes.Message, printFunc); +eventManager.unregister(eventTypes.Progress, progressFunc); + if any(strcmpi(controls.procedure, {procedures.NS.value, procedures.Dream.value})) result = mergeStructs(result, bayesResults); end diff --git a/API/events/triggerEvent.m b/API/events/triggerEvent.m index ba13892c1..d03470305 100644 --- a/API/events/triggerEvent.m +++ b/API/events/triggerEvent.m @@ -22,9 +22,9 @@ function triggerEvent(eventType, varargin) coder.extrinsic('eventManager.notify') if coder.target('MATLAB') || coder.target('MEX') if eventType == coderEnums.eventTypes.Message - fprintf("%s", varargin{1}); + eventManager.notify(eventType, varargin{1}); elseif eventType == coderEnums.eventTypes.Progress - textProgressBar(varargin{1}, varargin{2}); + eventManager.notify(eventType, varargin) elseif eventType == coderEnums.eventTypes.Plot result = varargin{1}; problemStruct = varargin{2}; diff --git a/examples/domains/customXY/domainsXY.m b/examples/domains/customXY/domainsXY.m index 735e23a21..4a54f0493 100644 --- a/examples/domains/customXY/domainsXY.m +++ b/examples/domains/customXY/domainsXY.m @@ -27,7 +27,7 @@ vfWater = 1 - totalVF; % Now convert the Volume Fractions to SLD's... -siSLD = vfSilicon * bulk_in; +siSLD = vfSilicon * bulk_in(contrast); oxSLD = vfOxide * 3.41e-6; % Layer SLD depends on whether we are calculating the domain or not... diff --git a/targetFunctions/+domainsTF/processCustomFunction.m b/targetFunctions/+domainsTF/processCustomFunction.m index f4ac574f3..b2d23bb84 100644 --- a/targetFunctions/+domainsTF/processCustomFunction.m +++ b/targetFunctions/+domainsTF/processCustomFunction.m @@ -18,11 +18,11 @@ coder.varsize('output2',[10000 numberOfOutputColumns], [1 1]); if isnan(str2double(functionHandle)) - [output1, subRoughs(i)] = callMatlabFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 1); - [output2, ~] = callMatlabFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 2); + [output1, subRoughs(i)] = callMatlabFunction(functionHandle, paramValues, bulkIns, bulkOuts, i, 1); + [output2, ~] = callMatlabFunction(functionHandle, paramValues, bulkIns, bulkOuts, i, 2); else - [output1, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 1); - [output2, ~] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 2); + [output1, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns, bulkOuts, i, 1); + [output2, ~] = callCppFunction(functionHandle, paramValues, bulkIns, bulkOuts, i, 2); end % If SLD is real, add dummy imaginary column diff --git a/targetFunctions/+normalTF/processCustomFunction.m b/targetFunctions/+normalTF/processCustomFunction.m index 2cc046fe6..0ae83aa6f 100644 --- a/targetFunctions/+normalTF/processCustomFunction.m +++ b/targetFunctions/+normalTF/processCustomFunction.m @@ -14,9 +14,9 @@ coder.varsize('output',[10000 numberOfOutputColumns],[1 1]); if isnan(str2double(functionHandle)) - [output, subRoughs(i)] = callMatlabFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 0); + [output, subRoughs(i)] = callMatlabFunction(functionHandle, paramValues, bulkIns, bulkOuts, i, 0); else - [output, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 0); + [output, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns, bulkOuts, i, 0); end % If SLD is real, add dummy imaginary column