Energy-Pathways-Group / GLOceanKit

Tools for physical oceanography in Matlab and Objective-C
21 stars 11 forks source link

How to directly pass options arguments to superclass #73

Open JeffreyEarly opened 1 year ago

JeffreyEarly commented 1 year ago

Nice answer here, https://www.mathworks.com/matlabcentral/answers/717495-passing-options-from-subclass-constructor-to-superclass

JeffreyEarly commented 10 months ago

Something like this works okay,

            arguments
                wvt WVTransform {mustBeNonempty}
                options.shouldUseBeta double {mustBeMember(options.shouldUseBeta,[0 1])} = 0 
                options.u_damp (1,1) double = 0.25 % characteristic speed used to set the damping. Try using uMax.
                options.r (1,1) double = 0
                options.fluxName char = 'WVNonlinearFluxQGForced'
                options.nu (1,1) double
                options.stateVariables WVVariableAnnotation = WVVariableAnnotation.empty()

                newOptions.EMA0
                newOptions.FA0 = []
                newOptions.FTA0 = 0
            end

            qgArgs = namedargs2cell(options);
            self@WVNonlinearFluxQG(wvt,qgArgs{:});