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/jacobiasmoptions.m

    r6098 r11871  
    1 function options=jacobiasmoptions(varargin)
     1function jacobiasm=jacobiasmoptions(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{:});
     9jacobiasm=struct();
    910
    1011%default jacobiasm options
    11 options={{'mat_type','aij'},{'ksp_type','gmres'},{'pc_type','asm'},{'sub_pc_type','jacobi'},{'pc_asm_overlap',3},{'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
     12jacobiasm.mat_type=getfieldvalue(options,'mat_type','aij');
     13jacobiasm.ksp_type=getfieldvalue(options,'ksp_type','gmres');
     14jacobiasm.pc_type=getfieldvalue(options,'pc_type','asm');
     15jacobiasm.sub_pc_type=getfieldvalue(options,'sub_pc_type','jacobi');
     16jacobiasm.pc_asm_overlap=getfieldvalue(options,'pc_asm_overlap',3);
     17jacobiasm.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
     18jacobiasm.ksp_rtol=getfieldvalue(options,'ksp_rtol',1e-15);
Note: See TracChangeset for help on using the changeset viewer.