Changeset 9267


Ignore:
Timestamp:
08/11/11 07:14:04 (14 years ago)
Author:
Mathieu Morlighem
Message:

Fixed marshalling problem for watercolumn and added checks in WriteData

Location:
issm/trunk/src/m
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/model.m

    r9113 r9267  
    269269                 pressure                            = {NaN,true,'DoubleMat',1};
    270270                 %Hydrology
    271                  watercolumn                         = {NaN,true,'Double'};
     271                 watercolumn                         = {NaN,true,'DoubleMat',1};
    272272                 hydro_n                             = {0,true,'Double'};
    273273                 hydro_CR                            = {0,true,'Double'};
  • issm/trunk/src/m/model/WriteData.m

    r8987 r9267  
    2222%Now, write the data itself.
    2323if     strcmpi(data_type,'Boolean'),% {{{
     24        if(numel(data)~=1), error(['field ' field ' cannot be marshalled as it has more than one element!']); end
     25
    2426        %first write length of record
    2527        fwrite(fid,1+4,'int');  %1 bool+code
     
    3234        % }}}
    3335elseif strcmpi(data_type,'Integer'), % {{{
     36        if(numel(data)~=1), error(['field ' field ' cannot be marshalled as it has more than one element!']); end
     37
    3438        %first write length of record
    3539        fwrite(fid,4+4,'int');  %1 integer + code
     
    4246        % }}}
    4347elseif strcmpi(data_type,'Double'), % {{{
     48        if(numel(data)~=1), error(['field ' field ' cannot be marshalled as it has more than one element!']); end
     49
    4450        %first write length of record
    4551        fwrite(fid,8+4,'int');  %1 double+code
  • issm/trunk/src/m/model/ismodelselfconsistent.m

    r9263 r9267  
    480480                        % {{{2
    481481                        fields={'spcwatercolumn'};
    482                         checksize(md,fields,[md.numberofnodes 2]);
     482                        checkforcing(md,fields);
    483483                        fields={'watercolumn'};
    484484                        checksize(md,fields,[md.numberofnodes 1]);
     
    726726                if size(field,1)==md.numberofnodes,
    727727                        if ~size(field,2)==1,
    728                                 message(['model not consistent: model ' md.name ': ' fieldname ' should have only one column as there are md.numberofnodes lines']);
     728                                message(['model not consistent: model ' md.name ': ' fields{i} ' should have only one column as there are md.numberofnodes lines']);
    729729                        end
    730730                elseif size(field,1)==md.numberofnodes+1
    731731                        if any(field(end,:)~=sort(field(end,:))),
    732                                 message(['model not consistent: model ' md.name ': ' fieldname ' columns should be chronological']);
     732                                message(['model not consistent: model ' md.name ': ' fields{i} ' columns should be chronological']);
    733733                        end
    734734                        if any(field(end,1:end-1)==field(end,2:end)),
    735                                 message(['model not consistent: model ' md.name ': ' fieldname ' columns must not contain duplicate timesteps']);
     735                                message(['model not consistent: model ' md.name ': ' fields{i} ' columns must not contain duplicate timesteps']);
    736736                        end
    737737                else
    738                         message(['model not consistent: model ' md.name ': ' fieldname ' should have md.numberofnodes or md.numberofnodes+1 lines']);
     738                        message(['model not consistent: model ' md.name ': ' fields{i} ' should have md.numberofnodes or md.numberofnodes+1 lines']);
    739739                end
    740740        end
Note: See TracChangeset for help on using the changeset viewer.