diff --git a/gui_support/app/case01.mat b/gui_support/app/1111.mat similarity index 100% rename from gui_support/app/case01.mat rename to gui_support/app/1111.mat diff --git a/gui_support/app/111results.mat b/gui_support/app/111results.mat new file mode 100644 index 0000000..4760069 Binary files /dev/null and b/gui_support/app/111results.mat differ diff --git a/gui_support/app/EDFMAppController.m b/gui_support/app/EDFMAppController.m index 32374e2..b3b99f8 100644 --- a/gui_support/app/EDFMAppController.m +++ b/gui_support/app/EDFMAppController.m @@ -680,6 +680,8 @@ classdef EDFMAppController < handle obj.App.(propName).Data = {}; elseif isnumeric(value) obj.App.(propName).Data = num2cell(value); + elseif iscell(value) + obj.App.(propName).Data = obj.prepareCellTableForUI(value); else obj.App.(propName).Data = value; end @@ -694,7 +696,7 @@ classdef EDFMAppController < handle if isempty(data) value = fallback; else - value = data; + value = obj.parseUITableData(data); end end @@ -776,6 +778,88 @@ classdef EDFMAppController < handle values{1} = firstValue; end + function tableData = prepareCellTableForUI(obj, rawData) + tableData = rawData; + for i = 1:size(rawData, 1) + for j = 1:size(rawData, 2) + tableData{i, j} = obj.serializeTableCell(rawData{i, j}); + end + end + end + + function value = parseUITableData(obj, data) + if isnumeric(data) + value = data; + return; + end + if ~iscell(data) + value = data; + return; + end + value = data; + for i = 1:size(data, 1) + for j = 1:size(data, 2) + value{i, j} = obj.parseTableCell(data{i, j}); + end + end + end + + function value = serializeTableCell(obj, rawValue) + if isnumeric(rawValue) || islogical(rawValue) + if isscalar(rawValue) + value = rawValue; + else + value = obj.valueToExpression(rawValue); + end + return; + end + if iscell(rawValue) + value = obj.valueToExpression(rawValue); + return; + end + if isstring(rawValue) && isscalar(rawValue) + value = char(rawValue); + return; + end + value = rawValue; + end + + function value = parseTableCell(~, rawValue) + if isnumeric(rawValue) || islogical(rawValue) + value = rawValue; + return; + end + if isstring(rawValue) && isscalar(rawValue) + rawValue = char(rawValue); + end + if ~ischar(rawValue) + value = rawValue; + return; + end + + textValue = strtrim(rawValue); + if isempty(textValue) + value = []; + return; + end + + numericValue = str2double(textValue); + if ~isnan(numericValue) && isempty(regexp(textValue, '[A-Za-z_''\[\]\{\};,]', 'once')) + value = numericValue; + return; + end + + if startsWith(textValue, '[') || startsWith(textValue, '{') + try + value = eval(textValue); %#ok + return; + catch + end + end + + value = rawValue; + end + function value = convertTableCellToDouble(~, cellValue) if isnumeric(cellValue) && isscalar(cellValue) value = double(cellValue); diff --git a/gui_support/templates/load_case_template_case06.m b/gui_support/templates/load_case_template_case06.m index e5b1269..d755c4b 100644 --- a/gui_support/templates/load_case_template_case06.m +++ b/gui_support/templates/load_case_template_case06.m @@ -27,10 +27,10 @@ config = build_basic_case_template( ... struct('pressure', 20, 'sw', 0.2, 'cs', 0.0, 'cb', 0.0), ... struct( ... 'well1', {{ - 'w1', 2, [20 10 1;20 10 2], 0.178/2, 0, 1; - 'w2', 2, [80 10 1;80 10 2], 0.178/2, 0, 1; - 'w3', 1, [20 40 1], 0.178/2, 0, 1; - 'w4', 1, [80 40 1], 0.178/2, 0, 1 + 'w1', 2, [2 2 1;2 2 2], 0.178/2, 0, 1; + 'w2', 2, [19 2 1;19 2 2], 0.178/2, 0, 1; + 'w3', 1, [2 9 1], 0.178/2, 0, 1; + 'w4', 1, [19 9 1], 0.178/2, 0, 1 }}, ... 'welloc', {{[ 255,255,5; diff --git a/gui_support/templates/load_case_template_case07.m b/gui_support/templates/load_case_template_case07.m index b501476..16e8e14 100644 --- a/gui_support/templates/load_case_template_case07.m +++ b/gui_support/templates/load_case_template_case07.m @@ -1,6 +1,24 @@ function config = load_case_template_case07() %LOAD_CASE_TEMPLATE_CASE07 Build config for case 7. +welloc = { + [255,255,5]; + [355,255,5]; + [455,255,5]; + [555,255,5]; + [655,255,5]; + [755,255,5] + }; + +well2 = { + 'w1_f1', 0, [], 0.178/2, 0, 4; + 'w1_f2', 0, [], 0.178/2, 0, 4; + 'w1_f3', 0, [], 0.178/2, 0, 4; + 'w1_f4', 0, [], 0.178/2, 0, 4; + 'w1_f5', 0, [], 0.178/2, 0, 4; + 'w1_f6', 0, [], 0.178/2, 0, 4 + }; + config = build_basic_case_template( ... 'case07', ... 'case07_oil_water_multiple_fracture_regimes', ... @@ -22,15 +40,8 @@ config = build_basic_case_template( ... struct('pressure', 20, 'sw', 0.2, 'cs', 0.0, 'cb', 0.0), ... struct( ... 'well1', {{}}, ... - 'welloc', {{[255,255,5]}, {[355,255,5]}, {[455,255,5]}, {[555,255,5]}, {[655,255,5]}, {[755,255,5]}}, ... - 'well2', {{ - 'w1_f1', 0, [], 0.178/2, 0, 4; - 'w1_f2', 0, [], 0.178/2, 0, 4; - 'w1_f3', 0, [], 0.178/2, 0, 4; - 'w1_f4', 0, [], 0.178/2, 0, 4; - 'w1_f5', 0, [], 0.178/2, 0, 4; - 'w1_f6', 0, [], 0.178/2, 0, 4 - }}), ... + 'welloc', {welloc}, ... + 'well2', {well2}), ... struct( ... 'time', [10; 10; 10; 200], ... 'dtmax', [0.5; 0.5; 0.5; 1], ...