Changeset 24313 for issm/trunk/src/m/consistency/checkfield.m
- Timestamp:
- 11/01/19 12:01:57 (5 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/m/consistency/checkfield.m
r22758 r24313 9 9 % - NaN: 1 if check that there is no NaN 10 10 % - Inf: 1 if check that there is no Inf 11 % - size: [lines cols], NaN for non checked dimensions 11 % - size: [lines cols], NaN for non checked dimensions, or 'universal' for any input type (nodal, element, time series, etc) 12 12 % - >: greater than provided value 13 13 % - >=: greater or equal to provided value … … 48 48 if exist(options,'size') 49 49 fieldsize=getfieldvalue(options,'size'); 50 if isnan(fieldsize(1)), 51 if (size(field,2)~=fieldsize(2)), 52 md = checkmessage(md,getfieldvalue(options,'message',... 53 ['field ''' fieldname ''' should have ' num2str(fieldsize(2)) ' columns'])); 54 end 55 elseif isnan(fieldsize(2)), 56 if (size(field,1)~=fieldsize(1)), 57 md = checkmessage(md,getfieldvalue(options,'message',... 58 ['field ''' fieldname ''' should have ' num2str(fieldsize(1)) ' lines'])); 59 end 60 else 61 if ((size(field,1)~=fieldsize(1)) | (size(field,2)~=fieldsize(2))) 62 md = checkmessage(md,getfieldvalue(options,'message',... 63 ['field ''' fieldname ''' size should be ' num2str(fieldsize(1)) ' x ' num2str(fieldsize(2))])); 50 if ischar(fieldsize), 51 if strcmp(fieldsize,'universal'), 52 53 %Check that vector size will not be confusing for ModelProcessorx 54 if (md.mesh.numberofvertices==md.mesh.numberofelements), 55 error('number of vertices is the same as number of elements'); 56 elseif (md.mesh.numberofvertices+1==md.mesh.numberofelements), 57 error('number of vertices +1 is the same as number of elements'); 58 elseif (md.mesh.numberofvertices==md.mesh.numberofelements+1), 59 error('number of vertices is the same as number of elements +1'); 60 end 61 62 %Uniform field 63 if (size(field,1)==1), 64 if (size(field,2)~=1), 65 md = checkmessage(md,getfieldvalue(options,'message',['field ''' fieldname ''' is not supported'])); 66 end 67 68 %vertex oriented input, only one column allowed 69 elseif (size(field,1)==md.mesh.numberofvertices), 70 if (size(field,2)~=1), 71 md = checkmessage(md,getfieldvalue(options,'message',['field ''' fieldname ''' is not supported'])); 72 end 73 74 %element oriented input, one or more column (patch) is ok 75 elseif (size(field,1)==md.mesh.numberofelements), 76 %nothing to do here (either constant per element, or defined on nodes) 77 78 %vertex time series 79 elseif (size(field,1)==md.mesh.numberofvertices+1), 80 if (size(field,2)<=1), 81 md = checkmessage(md,getfieldvalue(options,'message',['field ''' fieldname ''' is not supported'])); 82 end 83 84 %element time series 85 elseif (size(field,1)==md.mesh.numberofelements+1), 86 if (size(field,2)<=1), 87 md = checkmessage(md,getfieldvalue(options,'message',['field ''' fieldname ''' is not supported'])); 88 end 89 90 %else not supported 91 else 92 md = checkmessage(md,getfieldvalue(options,'message',['field ''' fieldname ''' is not supported'])); 93 end 94 else 95 error(['fieldsize ''' fieldsize ''' not supported yet']); 96 end 97 else 98 for i=1:numel(fieldsize) 99 if ~isnan(fieldsize(i)) & (size(field,i)~=fieldsize(i)) 100 md = checkmessage(md,getfieldvalue(options,'message',['field ''' fieldname ''' dimension # ' num2str(i) ' should be of size ' num2str(fieldsize(i))])); 101 end 64 102 end 65 103 end
Note:
See TracChangeset
for help on using the changeset viewer.