*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 84cb7b0d authored by Innerberger, Michael's avatar Innerberger, Michael
Browse files

Remove references to octave

parent 53bc521a
No related branches found
No related tags found
No related merge requests found
...@@ -85,14 +85,8 @@ classdef LevelData < handle ...@@ -85,14 +85,8 @@ classdef LevelData < handle
"domain", "domain", ... "domain", "domain", ...
"method", "method", ... "method", "method", ...
"identifier", "main", ... "identifier", "main", ...
"hostname", string(getHostname())); "hostname", string(getHostname()), ...
"timestamp", string(datetime('now', 'Format', 'yyyy-MM-dd_HH:mm:ss')));
% Save time of creation
if isOctave()
obj.metaData("timestamp") = datestr(now, 'yyyy-MM-dd_HH:mm:ss'); %#ok<TNOW1,DATST>
else
obj.metaData("timestamp") = char(datetime('now', 'Format', 'yyyy-MM-dd_HH:mm:ss'));
end
obj.category = dictionary(); obj.category = dictionary();
...@@ -298,4 +292,4 @@ end ...@@ -298,4 +292,4 @@ end
function spec = assembleSpecifier(width, format) function spec = assembleSpecifier(width, format)
spec = ['%', num2str(width), format]; spec = ['%', num2str(width), format];
end end
\ No newline at end of file
...@@ -49,8 +49,8 @@ function ax = plotLevel(obj, category, xVariable, yVariable) ...@@ -49,8 +49,8 @@ function ax = plotLevel(obj, category, xVariable, yVariable)
yValue = obj.get(1:obj.nLevel, yVariable{j}); yValue = obj.get(1:obj.nLevel, yVariable{j});
% Extract label for legend from dictionary % Extract label for legend from dictionary
if isfield(obj.dictionary, yVariable{j}) if obj.dictionary.isKey(yVariable{j})
variableLabel = obj.dictionary.(yVariable{j}); variableLabel = obj.dictionary(yVariable{j});
else else
variableLabel = yVariable{j}; variableLabel = yVariable{j};
end end
......
...@@ -31,9 +31,5 @@ function saveToFile(obj, folder, file) ...@@ -31,9 +31,5 @@ function saveToFile(obj, folder, file)
ensureFolderExists(folder); ensureFolderExists(folder);
% Save this object to file % Save this object to file
pathToMat = folder + '/' + file + '.mat'; pathToMat = folder + '/' + file + '.mat';
if isOctave() save(pathToMat, 'obj', '-v7.3');
save(pathToMat, 'obj', '-v7');
else
save(pathToMat, 'obj', '-v7.3');
end
end end
...@@ -73,14 +73,8 @@ classdef LevelDataCollection < handle ...@@ -73,14 +73,8 @@ classdef LevelDataCollection < handle
"domain", "domain", ... "domain", "domain", ...
"method", "method", ... "method", "method", ...
"identifier", "main", ... "identifier", "main", ...
"hostname", string(getHostname())); "hostname", string(getHostname()), ...
"timestamp", string(datetime('now', 'Format', 'yyyy-MM-dd_HH:mm:ss')));
% Save time of creation
if isOctave()
obj.metaData("timestamp") = datestr(now, 'yyyy-MM-dd_HH:mm:ss'); %#ok<TNOW1,DATST>
else
obj.metaData("timestamp") = char(datetime('now', 'Format', 'yyyy-MM-dd_HH:mm:ss'));
end
% Set identifier % Set identifier
if nargin >= 2 if nargin >= 2
......
...@@ -72,20 +72,14 @@ function ax = plotData(xData, variableName, data) ...@@ -72,20 +72,14 @@ function ax = plotData(xData, variableName, data)
% Extract label for legend from dictionary % Extract label for legend from dictionary
variableLabel = variableName{j}; variableLabel = variableName{j};
% Create plot % Create plot
if isOctave() errorbar(ax, xData, yMean, ...
fmt = [MARKER{j}, ';', variableLabel, ';']; yMean - yMin, yMax - yMean, ...
errorbar(ax, xData, yMean, ... 'LineStyle', '-', 'Marker', '.', ...
yMean - yMin, yMax - yMean, fmt); 'Color', COLOURORDER(j,:), ...
else 'DisplayName', variableLabel);
errorbar(ax, xData, yMean, ...
yMean - yMin, yMax - yMean, ...
'LineStyle', '-', 'Marker', '.', ...
'Color', COLOURORDER(j,:), ...
'DisplayName', variableLabel);
end
% Use double-logarithmic scales % Use double-logarithmic scales
set(ax, 'XScale', 'log', 'YScale', 'log'); set(ax, 'XScale', 'log', 'YScale', 'log');
% Add new line into the current figure when calling plotConvergence again % Add new line into the current figure when calling plotConvergence again
hold(ax, 'on'); hold(ax, 'on');
end end
end end
\ No newline at end of file
...@@ -34,10 +34,5 @@ function saveToFile(obj, folder, file) ...@@ -34,10 +34,5 @@ function saveToFile(obj, folder, file)
ensureFolderExists(folder); ensureFolderExists(folder);
% Save this object to file % Save this object to file
if isOctave() save(folder + '/' + file + '.mat', 'obj', '-v7.3');
warning(['LevelData not stored. Octave cannot save classdef objects. ', ...
'See GNU Octave Bug: #45833']);
else
save(folder + '/' + file + '.mat', 'obj', '-v7.3');
end
end end
...@@ -61,11 +61,7 @@ function output = fevalc(functionName, varargin) %#ok<INUSD> ...@@ -61,11 +61,7 @@ function output = fevalc(functionName, varargin) %#ok<INUSD>
% Create function call % Create function call
functioncall = 'feval(functionName, varargin{:})'; functioncall = 'feval(functionName, varargin{:})';
% Call function % Call function
if isOctave() [~, output] = evalc(functioncall);
evalc(['output = ' functioncall]);
else
[~, output] = evalc(functioncall);
end
% Store output in cell variable % Store output in cell variable
if ~iscell(output) if ~iscell(output)
output = {output}; output = {output};
......
...@@ -26,10 +26,6 @@ function configureLegend(ax, location) ...@@ -26,10 +26,6 @@ function configureLegend(ax, location)
% Specify location % Specify location
set(leg, 'Location', location); set(leg, 'Location', location);
% Set interpreter to latex in Matlab % Set interpreter to latex
if isOctave() set(leg, 'Interpreter', 'latex');
set(leg, 'Interpreter', 'tex');
else
set(leg, 'Interpreter', 'latex');
end
end end
function DICTIONARY = getDefaultDictionary() function dict = getDefaultDictionary()
%%GETDEFAULTDICTIONARY allows to specify default structure arrays for %%GETDEFAULTDICTIONARY allows to specify default structure arrays for
%dictionaries for legend labels in plots %dictionaries for legend labels in plots
% DICTIONARY = GETDEFAULTDICTIONARY() % dict = GETDEFAULTDICTIONARY()
% Copyright 2023 Philipp Bringmann % Copyright 2023 Philipp Bringmann
% %
...@@ -22,66 +22,31 @@ function DICTIONARY = getDefaultDictionary() ...@@ -22,66 +22,31 @@ function DICTIONARY = getDefaultDictionary()
% Dictionary for the latex description of data in the % Dictionary for the latex description of data in the
% convergence history plot % convergence history plot
DICTIONARY_MATLAB =... dict =...
struct('eta' , '$\eta_\ell$',... dictionary('eta' , '$\eta_\ell$',...
'etaVol' , '$\eta_{\textrm{vol}}$',... 'etaVol' , '$\eta_{\textrm{vol}}$',...
'etaJump' , '$\eta_{\textrm{jump}}$',... 'etaJump' , '$\eta_{\textrm{jump}}$',...
'oscDb' , '$\textrm{osc}(\textrm{D} u_{\textrm{D}}, \mathcal{F}_\ell(\Gamma_{\textrm{D}})$',... 'oscDb' , '$\textrm{osc}(\textrm{D} u_{\textrm{D}}, \mathcal{F}_\ell(\Gamma_{\textrm{D}})$',...
'oscNb' , '$\textrm{osc}(t_{\textrm{N}}, \mathcal{F}_\ell(\Gamma_{\textrm{N}})$',... 'oscNb' , '$\textrm{osc}(t_{\textrm{N}}, \mathcal{F}_\ell(\Gamma_{\textrm{N}})$',...
'oscF' , '$\textrm{osc}(f, \mathcal{T}_\ell)$',... 'oscF' , '$\textrm{osc}(f, \mathcal{T}_\ell)$',...
'mu' , '$|| f - \Pi_0 f ||_{L^2(\Omega)}$',... 'mu' , '$|| f - \Pi_0 f ||_{L^2(\Omega)}$',...
'est' , 'built-in',... 'est' , 'built-in',...
'res' , '$LS(f; \sigma_\ell, u_\ell)$',... 'res' , '$LS(f; \sigma_\ell, u_\ell)$',...
'resRed' , '$LS(\Pi_0 f; \sigma_\ell, u_\ell)$',... 'resRed' , '$LS(\Pi_0 f; \sigma_\ell, u_\ell)$',...
'resDiv' , '$|| f + \textrm{div} \sigma_\ell ||_{L^2(\Omega)}$',... 'resDiv' , '$|| f + \textrm{div} \sigma_\ell ||_{L^2(\Omega)}$',...
'resL2' , '$|| \sigma_\ell - \nabla u_\ell ||_{L^2(\Omega)}$',... 'resL2' , '$|| \sigma_\ell - \nabla u_\ell ||_{L^2(\Omega)}$',...
'resDev' , '$|| \textrm{dev} \sigma_\ell - \textrm{D} u_\ell ||_{L^2(\Omega)}$',... 'resDev' , '$|| \textrm{dev} \sigma_\ell - \textrm{D} u_\ell ||_{L^2(\Omega)}$',...
'resMat' , '$|| C^{-1} \sigma_\ell - \varepsilon u_\ell ||_{L^2(\Omega)}$',... 'resMat' , '$|| C^{-1} \sigma_\ell - \varepsilon u_\ell ||_{L^2(\Omega)}$',...
'errU' , '$|| u - u_\ell ||_{H^1(\Omega)}$',... 'errU' , '$|| u - u_\ell ||_{H^1(\Omega)}$',...
'errL2U' , '$|| u - u_\ell ||_{L^2(\Omega)}$',... 'errL2U' , '$|| u - u_\ell ||_{L^2(\Omega)}$',...
'errGradU' , '$||| u - u_\ell |||$',... 'errGradU' , '$||| u - u_\ell |||$',...
'errSigma' , '$|| \sigma - \sigma_\ell ||_{H(\textrm{div},\Omega)}$',... 'errSigma' , '$|| \sigma - \sigma_\ell ||_{H(\textrm{div},\Omega)}$',...
'errL2Sigma' , '$|| \sigma - \sigma_\ell ||_{L^2(\Omega)}$',... 'errL2Sigma' , '$|| \sigma - \sigma_\ell ||_{L^2(\Omega)}$',...
'errDivSigma' , '$|| \textrm{div} (\sigma - \sigma_\ell) ||_{L^2(\Omega)}$',... 'errDivSigma' , '$|| \textrm{div} (\sigma - \sigma_\ell) ||_{L^2(\Omega)}$',...
'runtime' , 'runtime',... 'runtime' , 'runtime',...
'setupTime' , 'setuptime',... 'setupTime' , 'setuptime',...
'solutionTime' , 'solutiontime',... 'solutionTime' , 'solutiontime',...
'estimatorTime' , 'estimatortime',... 'estimatorTime' , 'estimatortime',...
'refinementTime', 'refinementtime',... 'refinementTime', 'refinementtime',...
'condition' , 'condition'); 'condition' , 'condition');
% Dictionary for the latex description of data in the convergence end
% history plot for octave
DICTIONARY_OCTAVE =...
struct('eta' , '\eta_{l}',...
'etaVol' , '\eta_{{vol,l}}',...
'etaJump' , '\eta_{{jump,l}}',...
'oscDb' , '{osc}({D} u_{{D}}, F_l(\Gamma_{{D}}))',...
'oscNb' , '{osc}(t_{{N}}, F_l(\Gamma_{{N}}))',...
'oscF' , '{osc}(f, T_\ell)',...
'mu' , '|| f - \Pi_0 f ||_{L^2(\Omega)',...
'est' , 'built-in',...
'res' , 'LS(f; \sigma_l, u_l)',...
'resRed' , 'LS(\Pi_0 f; \sigma_l, u_l)',...
'resDiv' , '|| f + {div} \sigma_l ||_{L^2(\Omega)}',...
'resL2' , '|| \sigma_l - \nabla u_l ||_{L^2(\Omega)}',...
'resDev' , '|| {dev} \sigma_l - {D} u_l ||_{L^2(\Omega)}',...
'resMat' , '|| C^{-1} \sigma_l - \epsilon u_l ||_{L^2(\Omega)}',...
'errU' , '|| u - u_l ||_{H^1(\Omega)}',...
'errL2U' , '|| u - u_\ell ||_{L^2(\Omega)}',...
'errGradU' , '||| u - u_\ell |||',...
'errSigma' , '|| \sigma - \sigma_l ||_{H({div},\Omega)}',...
'errL2Sigma' , '|| \sigma - \sigma_\ell ||_{L^2(\Omega)}',...
'errDivSigma' , '|| {div} (\sigma - \sigma_\ell) ||_{L^2(\Omega)}',...
'runtime' , 'runtime',...
'setupTime' , 'setuptime',...
'solutionTime' , 'solutiontime',...
'estimatorTime' , 'estimatortime',...
'refinementTime', 'refinementtime',...
'condition' , 'condition');
% Choose dictionary according to running program
if isOctave()
DICTIONARY = DICTIONARY_OCTAVE;
else
DICTIONARY = DICTIONARY_MATLAB;
end
end
\ No newline at end of file
function [COLOURORDER, MARKER] = getPlotStyle() function [colorOrder, marker] = getPlotStyle()
%%GETPLOTSTYLE creates lists of default colours and markers for plotting %%GETPLOTSTYLE creates lists of default colours and markers for plotting
% [COLOURORDER, MARKER] = GETPLOTSTYLE() % [colorOrder, marker] = GETPLOTSTYLE()
% Copyright 2023 Philipp Bringmann % Copyright 2023 Philipp Bringmann
% %
...@@ -21,40 +21,32 @@ function [COLOURORDER, MARKER] = getPlotStyle() ...@@ -21,40 +21,32 @@ function [COLOURORDER, MARKER] = getPlotStyle()
% Generate a sequence of colours for the graphs % Generate a sequence of colours for the graphs
% Matlab default % Matlab default
COLOURORDER = [0 0.4470 0.7410; colorOrder = [0 0.4470 0.7410;
0.8500 0.3250 0.0980; 0.8500 0.3250 0.0980;
0.9290 0.6940 0.1250; 0.9290 0.6940 0.1250;
0.4940 0.1840 0.5560; 0.4940 0.1840 0.5560;
0.4660 0.6740 0.1880; 0.4660 0.6740 0.1880;
0.3010 0.7450 0.9330; 0.3010 0.7450 0.9330;
0.6350 0.0780 0.1840]; 0.6350 0.0780 0.1840];
% ALTERNATIVE: TU corporate design colours % ALTERNATIVE: TU corporate design colours
% COLOURORDER = [0 0.4 0.6; % colorOrder = [0 0.4 0.6;
% 0.3922 0.3882 0.3882; % 0.3922 0.3882 0.3882;
% 0 0.4941 0.4431; % 0 0.4941 0.4431;
% 0.7294 0.2745 0.5098; % 0.7294 0.2745 0.5098;
% 0.8824 0.5373 0.1333]; % 0.8824 0.5373 0.1333];
% ALTERNATIVE: variable length colour sequence % ALTERNATIVE: variable length colour sequence
% nColour = max(ceil(nVariable^(1/3)), 2); % nColor = max(ceil(nVariable^(1/3)), 2);
nColour = 3; nColor = 3;
[red, green, blue] = meshgrid(linspace(0, 1, nColour)); [red, green, blue] = meshgrid(linspace(0, 1, nColor));
% COLOURORDER = [red(:), green(:), blue(:)]; % colorOrder = [red(:), green(:), blue(:)];
% Append % Append
COLOURORDER = [COLOURORDER; red(:), green(:), blue(:)]; colorOrder = [colorOrder; red(:), green(:), blue(:)];
% Remove white as line colour % Remove white as line colour
COLOURORDER = COLOURORDER(1:end-1,:); colorOrder = colorOrder(1:end-1,:);
% Define sequence of markers % Define sequence of markers
MATLAB_MARKER = {'o', '+', 'x', 'square', 'diamond', '*', '^', 'v', ... marker = {'o', '+', 'x', 'square', 'diamond', '*', '^', 'v', ...
'pentagram', 'hexagram', '<', '>', '.', '_', '|'}; 'pentagram', 'hexagram', '<', '>', '.', '_', '|'};
OCTAVE_MARKER = {'~o-k', '~x-r', '~s-g', '~d-b', '~p-c', '~^-m', '~v-y'};
% Choose sequence of markers
if isOctave()
MARKER = OCTAVE_MARKER;
else
MARKER = MATLAB_MARKER;
end
end end
function retval = isOctave()
%%ISOCTAVE checks whether this function is called from Octave
%
% Source:
%
% https://octave.org/doc/v5.1.0/How-to-Distinguish-Between-Octave-and-Matlab.html
persistent cacheval; % speeds up repeated calls
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment