Changeset 9822


Ignore:
Timestamp:
09/16/11 12:21:52 (14 years ago)
Author:
Mathieu Morlighem
Message:

fixed disp for solver

File:
1 edited

Legend:

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

    r9821 r9822  
    7979                         fclose(fid);
    8080                 end %}}}
    81                  function string=PetscString(solver) % {{{
    82 
    83                          %initialize string:
    84                          string='';
    85 
    86                          %start writing options
    87                          for i=1:length(solver),
    88                                  option=solver{i};
    89                                  if isempty(option),
    90                                          %do nothing
    91                                  elseif length(option)==1,
    92                                          %this option has only one argument
    93                                          string=[string ' -' option{1}];
    94                                  elseif length(option)==2,
    95                                          %option with value. value can be string or scalar
    96                                          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                                          else
    101                                                  error(['PetscString error: option #' num2str(i) ' is not well formatted']);
    102                                          end
    103                                  else
    104                                          error(['PetscString error: option #' num2str(i) ' is not well formatted']);
    105                                  end
    106                          end
    107                  end % }}}
    10881                 function disp(obj) % {{{1
    10982                        disp(sprintf('   solver parameters:'));
     
    11285                                analysis=obj.options{i,1};
    11386                                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
    115110                                disp(sprintf('   %s -> ''%s''',EnumToString(analysis),string));
    116111                        end
Note: See TracChangeset for help on using the changeset viewer.