Changeset 2660


Ignore:
Timestamp:
11/16/09 10:02:36 (15 years ago)
Author:
seroussi
Message:

added test on rifts fill
correcter check on rifts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/ismodelselfconsistent.m

    r2528 r2660  
    122122                error(['model not consistent: models with rifts are only supported in 2d for now!']);
    123123        end
    124 end
    125 if ~isstruct(md.rifts),
     124        if ~isstruct(md.rifts),
     125                error(['model not consistent: md.rifts should be a structure!']);
     126        end
     127        if ~isempty(find(md.segmentmarkers>=2)),
     128                %We have segments with rift markers, but no rift structure!
     129                error(['model not consistent: model ' md.name ' should be processed for rifts (run meshprocessrifts)!']);
     130        end
     131        %Check that rifts are filled with proper material
     132        checkvalues(md,{'rifts.fill'},[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
     133else
    126134        if ~isnan(md.rifts),
    127                 if ~isempty(find(md.segmentmarkers>=2)),
    128                         %We have segments with rift markers, but no rift structure!
    129                         error(['model not consistent: model ' md.name ' should be processed for rifts (run meshprocessrifts)!']);
    130                 end
     135                error(['model not consistent: md.rifts shoud be NaN since md.numrifts is 0!']);
    131136        end
    132137end
     
    432437        end
    433438end
     439
     440function checkvalues(md,fields,values)
     441        %CHECKVALUE - check that a field has a certain value
     442        for i=1:length(fields),
     443                if eval(['~ismember( md.' fields{i} ',values)']),
     444                        error(['model not consistent: field ' fields{i} ' should have values in ' num2str(values)]);
     445                end
     446        end
     447end
Note: See TracChangeset for help on using the changeset viewer.