Skip to content

Commit

Permalink
Add MATLAB version 2018a support (#113)
Browse files Browse the repository at this point in the history
* MATLAB 2018a fixes:
  + First arg to struct must be char, not string 
  + Need array construct to join strings
  + Revert to toolbox installation checking used prior to 5acf452
* Clarify legacy support in docs
* Fix typo when checking for installed but unlicensed optimization toolbox

Co-authored-by: Ryan Coe <[email protected]>
Co-authored-by: zmorrell-sand <[email protected]>
  • Loading branch information
3 people authored Apr 4, 2020
1 parent 9de880c commit 4c1db6f
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 47 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ optimal control.

Dependency | Website | Required?
----------------------------------- | --------------------------------------------------------------- | ---------
MATLAB | https://www.mathworks.com/products/matlab.html | yes (>=2018a)
MATLAB | https://www.mathworks.com/products/matlab.html | yes\*
MATLAB Optimization Toolbox | https://www.mathworks.com/products/optimization.html | yes
Nemoh | https://github.com/LHEEA/Nemoh | yes
NEMOH | https://github.com/LHEEA/Nemoh | yes
WAFO<sup>1</sup> | https://github.com/wafo-project/wafo | no
MATLAB Parallel Computing Toolbox | https://www.mathworks.com/products/parallel-computing.html | no

The oldest compatible version of MATLAB currently tested is **MATLAB 2018a
(9.4.0.949201)**. Please help the development team by reporting compatibility
with older versions [HERE](
https://github.com/SNL-WaterPower/WecOptTool/issues/91).
\* The latest WecOptTool release, version 0.1.0, was tested on **MATLAB
2020a**, whilst the oldest compatible version known is **MATLAB 2018a**. Please
help the development team by reporting compatibility with other versions
[HERE]( https://github.com/SNL-WaterPower/WecOptTool/issues/91). The
development version will support the latest available version of MATLAB, but no
guarantees are given regarding legacy MATLAB support.

<sup>1</sup>_WecOptTool requires an input wave spectra which is formatted to
match the output of the WAFO toolbox. These spectra can also be produced 'by
Expand Down
28 changes: 10 additions & 18 deletions dependencyCheck.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,20 @@
optimizationToolboxLicensed = license('test', "Optimization_Toolbox");

% Second check if installed
addons = matlab.addons.installedAddons();

if isempty(addons)

optimizationToolboxInstalled = false;

else

iOptimizationToolbox = addons.Name == "Optimization Toolbox";

if ~iOptimizationToolbox
optimizationToolboxInstalled = false;
else
optimizationToolboxInstalled = ...
addons.Enabled(iOptimizationToolbox);
installedProducts = ver;
installedNames = {installedProducts(:).Name};
optimizationToolboxInstalled = false;

for name = installedNames
if contains(name, "Optimization Toolbox")
optimizationToolboxInstalled = true;
break
end

end

if optimizationToolboxLicensed && optimizationToolboxInstalled
fprintf('Optimization Toolbox: Found\n');
elseif ~optimizationToolboxLicensed && opmizationToolboxInstalled
elseif ~optimizationToolboxLicensed && optimizationToolboxInstalled
allfoundflag = false;
fprintf('Optimization Toolbox: Unlicensed\n');
else
Expand Down Expand Up @@ -102,7 +94,7 @@
elseif ~parallelToolboxLicensed && parallelToolboxInstalled
fprintf('Parallel Toolbox: Unlicensed\n');
else
fprintf('Paralell Toolbox: Not Installed\n');
fprintf('Parallel Toolbox: Not Installed\n');
end

%% WAFO
Expand Down
13 changes: 7 additions & 6 deletions docs/user/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ WecOptTool.
+----------------------+------------------------------------------------------------+-----------+
| Dependency | Website | Required? |
+======================+============================================================+===========+
| MATLAB | https://www.mathworks.com/products/matlab.html | yes |
| | | (>=2018a) |
| MATLAB | https://www.mathworks.com/products/matlab.html | yes\* |
+----------------------+------------------------------------------------------------+-----------+
| MATLAB Optimization | https://www.mathworks.com/products/optimization.html | yes |
| Toolbox | | |
Expand All @@ -29,10 +28,12 @@ WecOptTool.
| Toolbox [#f2]_ | | |
+----------------------+------------------------------------------------------------+-----------+

The oldest compatible version of MATLAB currently tested is **MATLAB 2018a
(9.4.0.949201)**. Please help the development team by reporting compatibility
with older versions `HERE
<https://github.com/SNL-WaterPower/WecOptTool/issues/91>`__.
\* The latest WecOptTool release, version 0.1.0, was tested on **MATLAB
2020a**, whilst the oldest compatible version known is **MATLAB 2018a**. Please
help the development team by reporting compatibility with other versions `HERE
<https://github.com/SNL-WaterPower/WecOptTool/issues/91>`__. The development
version will support the latest available version of MATLAB, but no guarantees
are given regarding legacy MATLAB support.

.. _user-setup-download:

Expand Down
Binary file added test_results_serial.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion toolbox/+WecOptLib/+utils/getSrcRootPath.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

% Linux requires a leading slash
if ~ispc
srcRootPath = append(filesep, srcRootPath);
srcRootPath = [filesep, srcRootPath];
end

end
Expand Down
23 changes: 8 additions & 15 deletions toolbox/+WecOptLib/+utils/hasParallelToolbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,17 @@

licensed = logical(license('test', "Distrib_Computing_Toolbox"));

addons = matlab.addons.installedAddons();

if isempty(addons)

installed = false;

else

iParallelToolbox = addons.Name == "Parallel Computing Toolbox";
installedProducts = ver;
installedNames = {installedProducts(:).Name};
installed = false;

if ~iParallelToolbox
installed = false;
else
installed = addons.Enabled(iParallelToolbox);
for name = installedNames
if contains(name, "Parallel Computing Toolbox")
installed = true;
break
end

end

combined = licensed && installed;

end
Expand Down
2 changes: 1 addition & 1 deletion toolbox/+WecOptLib/+utils/writeConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function writeConfig(key, value, varargin)
if exist(configPath, 'file')
config = jsondecode(fileread(configPath));
else
config = struct(p.Results.key, p.Results.value);
config = struct(char(p.Results.key), p.Results.value);
end

if strcmp(p.Results.value, "")
Expand Down

0 comments on commit 4c1db6f

Please sign in to comment.