Files
CoolProp/wrappers/MATLAB/AbstractState.m
Dev-iL ad44738d01 Topic 1497 - deprecating the SWIG wrapper for MATLAB in favor of a python-based alternative. (#1543)
* Replaced the old SWIG-based wrapper with a python-based one.

- `PropsSI.m` is now the entry point.
- Added tests.
- Documentation updated.

* Documentation converted from Markdown to reStructredText

Following https://github.com/CoolProp/CoolProp/issues/1497#issuecomment-324845758.

* Further fixes to documentation.

* Further fixes to documentation #2.

Worked around the indentation issue in the numbered list.

* Added handling of arrays with zero dimensions to matpy

* Added a convenience wrapper for the low-level AbstractState API

- Readme updated accordingly.
- Tests updated accordingly.

* Renamd CoolProps to CoolProp
2017-09-03 10:10:10 -06:00

38 lines
1.6 KiB
Matlab

function [abState, CoolProp] = AbstractState(varargin)
% AbstractState is a MATLAB wrapper for the python binding of the CoolProp
% low-level interface - AbstractState.
%
% It is highly advised to assign the 2nd output of this function into a variable
% called 'CoolProp' in the calling workspace (for compatibility with the python
% code examples appearing in the documentation).
%
% IMPORTANT:
% (1) No input checking is performed! It is up to the user to ensure valid inputs.
% (2) When using the state object for computations, outputs should be assumed to
% consist of python objects (arrays, lists, etc.) and converted to MATLAB
% variables accordingly. The provided matpy utility may be useful for that.
%
% INPUTS:
% The 1st input contains the backend name.
% The 2nd input contains a fluid name, or a set of fluid names delimited by '&'.
%
% The following input structures are supported:
% AbstractState({'HEOS', 'Water'});
% AbstractState( 'HEOS', 'Water' );
% AbstractState( 'BICUBIC&HEOS', 'Methane&Ethane' );
%
% In MATLAB R2016b and newer, string objects can be used in place of char arrays:
% AbstractState( "HEOS", "Water" ); % ( >=R2016b syntax )
%
% For more information on CoolProp's AbstractState class see:
% 1. http://coolprop.sourceforge.net/coolprop/LowLevelAPI.html
% 2. \CoolProp\include\AbstractState.h
%
% Copyright (C) 2017 Iliya Romm, under the MIT license.
CoolProp = py.importlib.import_module('CoolProp.CoolProp');
if iscell(varargin{1})
abState = CoolProp.AbstractState(varargin{1}{:});
else
abState = CoolProp.AbstractState(varargin{:});
end