Changeset 9822
- Timestamp:
- 09/16/11 12:21:52 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/solver.m
r9821 r9822 79 79 fclose(fid); 80 80 end %}}} 81 function string=PetscString(solver) % {{{82 83 %initialize string:84 string='';85 86 %start writing options87 for i=1:length(solver),88 option=solver{i};89 if isempty(option),90 %do nothing91 elseif length(option)==1,92 %this option has only one argument93 string=[string ' -' option{1}];94 elseif length(option)==2,95 %option with value. value can be string or scalar96 if isscalar(option{2}),97 string=[string ' -' option{1} ' ' num2str(option{2})];98 elseif ischar(option{2}),99 string=[string ' -' option{1} ' ' option{2}];100 else101 error(['PetscString error: option #' num2str(i) ' is not well formatted']);102 end103 else104 error(['PetscString error: option #' num2str(i) ' is not well formatted']);105 end106 end107 end % }}}108 81 function disp(obj) % {{{1 109 82 disp(sprintf(' solver parameters:')); … … 112 85 analysis=obj.options{i,1}; 113 86 ioptions=obj.options{i,2}; 114 string=PetscString(ioptions); 87 88 string=''; 89 for i=1:length(ioptions), 90 option=ioptions{i}; 91 if isempty(option), 92 %do nothing 93 elseif length(option)==1, 94 %this option has only one argument 95 string=[string ' -' option{1}]; 96 elseif length(option)==2, 97 %option with value. value can be string or scalar 98 if isscalar(option{2}), 99 string=[string ' -' option{1} ' ' num2str(option{2})]; 100 elseif ischar(option{2}), 101 string=[string ' -' option{1} ' ' option{2}]; 102 else 103 error(['PetscString error: option #' num2str(i) ' is not well formatted']); 104 end 105 else 106 error(['PetscString error: option #' num2str(i) ' is not well formatted']); 107 end 108 end 109 115 110 disp(sprintf(' %s -> ''%s''',EnumToString(analysis),string)); 116 111 end
Note:
See TracChangeset
for help on using the changeset viewer.