Ignore:
Timestamp:
04/03/12 10:11:50 (13 years ago)
Author:
Mathieu Morlighem
Message:

solver is now an object with dynamic properties, and each property is a struct with all the PETSc options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/model/solvers/jacobicgoptions.m

    r10565 r11871  
    1 function options=jacobiasmoptions(varargin)
     1function jacobicg=jacobiacgoptions(varargin)
    22%ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
    33%
     
    66                         
    77%retrieve options provided in varargin
    8 arguments=pairoptions(varargin{:});
     8options=pairoptions(varargin{:});
     9jacobicg=struct();
    910
    1011%default jacobiasm options
    11 options={{'mat_type','aij'},{'ksp_type','cg'},{'ksp_max_it',100},{'ksp_rtol',1e-15'}};
    12 
    13 %now, go through our arguments, and write over default options.
    14 for i=1:size(arguments.list,1),
    15         arg1=arguments.list{i,1};
    16         arg2=arguments.list{i,2};
    17         found=0;
    18         for j=1:size(options,2),
    19                 joption=options{j};
    20                 if strcmpi(joption{1},arg1),
    21                         joption{2}=arg2;
    22                         options{j}=joption;
    23                         found=1;
    24                         break;
    25                 end
    26         end
    27         if ~found,
    28                 %this option did not exist, add it:
    29                 options{end+1}={arg1,arg2};
    30         end
    31 end
     12jacobicg.mat_type=getfieldvalue(options,'mat_type','aij');
     13jacobicg.ksp_type=getfieldvalue(options,'ksp_type','cg');
     14jacobicg.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
     15jacobicg.ksp_rtol=getfieldvalue(options,'ksp_rtol',1e-15);
Note: See TracChangeset for help on using the changeset viewer.