source: issm/trunk/src/m/solvers/jacobicgoptions.py

Last change on this file was 24313, checked in by Mathieu Morlighem, 5 years ago

merged trunk-jpl and trunk for revision 24310

File size: 1.0 KB
RevLine 
[24313]1import pairoptions
[17806]2
[24313]3
[11791]4def jacobicgoptions(*args):
[24313]5 #ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
6 #
7 # Usage:
8 # options = jacobicgoptions
[11791]9
[24313]10 #retrieve options provided in varargin
11 arguments = pairoptions.pairoptions(*args)
12
13 options = [['toolkit', 'petsc'],
14 ['mat_type', 'mpiaij'],
15 ['ksp_type', 'cg'],
16 ['ksp_max_it', 100],
17 ['ksp_rtol', 1e-15]]
18
19 #now, go through our arguments, and write over default options.
20 for i in range(len(arguments.list)):
21 arg1 = arguments.list[i][0]
22 arg2 = arguments.list[i][1]
23 found = 0
24 for j in range(len(options)):
25 joption = options[j][0]
26 if joption == arg1:
27 joption[1] = arg2
28 options[j] = joption
29 found = 1
30 break
31 if not found:
32 #this option did not exist, add it:
33 options.append([arg1, arg2])
34 return options
Note: See TracBrowser for help on using the repository browser.