[9612] | 1 | %BASAL FORCINGS class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % basalforcings=basalforcings();
|
---|
| 5 |
|
---|
| 6 | classdef basalforcings
|
---|
| 7 | properties (SetAccess=public)
|
---|
| 8 | melting_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
|
---|
| 9 | melting_rate_correction = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
|
---|
| 10 | geothermalflux = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
|
---|
| 11 | end
|
---|
| 12 | methods
|
---|
| 13 | function obj = basalforcings(varargin) % {{{
|
---|
| 14 | switch nargin
|
---|
| 15 | case 0
|
---|
| 16 | obj=setdefaultparameters(obj);
|
---|
| 17 | case 1
|
---|
| 18 | in=varargin{1};
|
---|
| 19 | if (isa(in,'numeric') & in==0),
|
---|
| 20 | % requesting templates do nothing
|
---|
| 21 | else
|
---|
| 22 | error('constructor not supported');
|
---|
| 23 | end
|
---|
| 24 | otherwise
|
---|
| 25 | error('constructor not supported');
|
---|
| 26 | end
|
---|
| 27 | end % }}}
|
---|
| 28 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 29 |
|
---|
| 30 | %first, use the defaults provided by the properties definition above.
|
---|
| 31 | fieldnames=fields(obj);
|
---|
| 32 | for i=1:length(fieldnames),
|
---|
| 33 | fieldname=fieldnames{i};
|
---|
| 34 | obj.(fieldname)=obj.(fieldname).default;
|
---|
| 35 | end
|
---|
| 36 | end % }}}
|
---|
[9739] | 37 | function checkconsistency(obj,md) % {{{
|
---|
| 38 |
|
---|
[9749] | 39 | fields={'melting_rate','geothermalflux'};
|
---|
| 40 | checksize(md,'basalforcings',fields,[md.mesh.numberofvertices 1]);
|
---|
[9739] | 41 | end % }}}
|
---|
[9612] | 42 | end
|
---|
| 43 | end
|
---|