Changeset 15768
- Timestamp:
- 08/09/13 10:07:08 (12 years ago)
- Location:
- issm/trunk-jpl/src/m/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/m/classes/masstransport.m ¶
r15767 r15768 14 14 requested_outputs = NaN; 15 15 end 16 methods (Static) 17 function obj = loadobj(obj) % {{{ 18 % This function is directly called by matlab when a model object is 19 % loaded. If the input is a struct it is an old version of this class and 20 % old fields must be recovered (make sure they are in the deprecated 21 % model properties) 22 23 if verLessThan('matlab','7.9'), 24 disp('Warning: your matlab version is old and there is a risk that load does not work correctly'); 25 disp(' if the model is not loaded correctly, rename temporarily loadobj so that matlab does not use it'); 26 27 % This is a Matlab bug: all the fields of md have their default value 28 % Example of error message: 29 % Warning: Error loading an object of class 'model': 30 % Undefined function or method 'exist' for input arguments of type 'cell' 31 % 32 % This has been fixed in MATLAB 7.9 (R2009b) and later versions 33 end 34 35 if isstruct(obj) 36 disp('Recovering masstransport from older version'); 37 objstruct = obj; 38 obj = structtoobj(masstransport(),objstruct); 39 end 40 end% }}} 41 end 16 42 methods 17 43 function obj = masstransport(varargin) % {{{ … … 19 45 case 0 20 46 obj=setdefaultparameters(obj); 47 case 1 48 inputstruct=varargin{1}; 49 list1 = properties('masstransport'); 50 list2 = fieldnames(inputstruct); 51 for i=1:length(list1) 52 fieldname = list1{i}; 53 if ismember(fieldname,list2), 54 obj.(fieldname) = inputstruct.(fieldname); 55 end 56 end 21 57 otherwise 22 58 error('constructor not supported'); -
TabularUnified issm/trunk-jpl/src/m/classes/model/model.m ¶
r15767 r15768 865 865 if isfield(structmd,'max_steadystate_iterations'), md.steadystate.maxiter=structmd.max_steadystate_iterations; end 866 866 if isfield(structmd,'isdiagnostic'), md.transient.isdiagnostic=structmd.isdiagnostic; end 867 if isfield(structmd,'is masstransport'), md.transient.ismasstransport=structmd.ismasstransport; end867 if isfield(structmd,'isprognostic'), md.transient.ismasstransport=structmd.isprognostic; end 868 868 if isfield(structmd,'isthermal'), md.transient.isthermal=structmd.isthermal; end 869 869 if isfield(structmd,'control_analysis'), md.inversion.iscontrol=structmd.control_analysis; end … … 942 942 md.verbose=verbose; 943 943 end 944 if size(md.diagnostic.icefront,2)==3 || size(md.diagnostic.icefront,2)==5, 945 front=md.diagnostic.icefront; 946 md.diagnostic.icefront=[front 1*md.mask.elementonfloatingice(front(:,end))]; 947 end 944 948 945 if isfield(structmd,'spcvelocity'), 949 946 md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1); … … 1046 1043 md.diagnostic.referential=NaN*ones(md.mesh.numberofvertices,6); 1047 1044 end 1048 1049 1045 if ~isfield(structmd,'loadingforce'); 1050 1046 md.diagnostic.loadingforce=0*ones(md.mesh.numberofvertices,3); 1047 end 1048 1049 %2013 August 9 1050 if isfield(structmd,'prognostic') & isa(structmd.prognostic,'prognostic'), 1051 disp('Recovering old prognostic class'); 1052 md.masstransport=masstransport(structmd.prognostic); 1051 1053 end 1052 1054 end% }}} -
TabularUnified issm/trunk-jpl/src/m/classes/oldclasses/diagnostic.m ¶
r15614 r15768 26 26 requested_outputs = NaN; 27 27 end 28 methods (Static) 29 function obj = loadobj(obj) % {{{ 30 % This function is directly called by matlab when a model object is 31 % loaded. If the input is a struct it is an old version of this class and 32 % old fields must be recovered (make sure they are in the deprecated 33 % model properties) 34 35 if verLessThan('matlab','7.9'), 36 disp('Warning: your matlab version is old and there is a risk that load does not work correctly'); 37 disp(' if the model is not loaded correctly, rename temporarily loadobj so that matlab does not use it'); 38 39 % This is a Matlab bug: all the fields of md have their default value 40 % Example of error message: 41 % Warning: Error loading an object of class 'model': 42 % Undefined function or method 'exist' for input arguments of type 'cell' 43 % 44 % This has been fixed in MATLAB 7.9 (R2009b) and later versions 45 end 46 47 if size(md.diagnostic.icefront,2)==3 || size(md.diagnostic.icefront,2)==5, 48 front=md.diagnostic.icefront; 49 md.diagnostic.icefront=[front 1*md.mask.elementonfloatingice(front(:,end))]; 50 end 51 end% }}} 52 end 28 53 methods 29 54 function obj = diagnostic(varargin) % {{{ … … 151 176 152 177 end % }}} 178 153 179 function marshall(obj,md,fid) % {{{ 154 180 WriteData(fid,'object',obj,'fieldname','spcvx','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
Note:
See TracChangeset
for help on using the changeset viewer.