source: issm/trunk-jpl/src/m/solvers/asmoptions.py@ 26383

Last change on this file since 26383 was 26383, checked in by schlegel, 4 years ago

CHG: asmoptions needs to return a dictionary object

File size: 1.2 KB
Line 
1from collections import OrderedDict
2from pairoptions import pairoptions
3
4def asmoptions(*args):
5 #ASMOPTIONS - return ASM petsc options
6 #
7 # Usage:
8 # options = asmoptions
9
10 #retrieve options provided in *args
11 arguments = pairoptions(*args)
12
13 options = [['toolkit', 'petsc'],
14 ['mat_type', 'mpiaij'],
15 ['ksp_type', 'gmres'],
16 ['pc_type', 'asm'],
17 ['sub_pc_type', 'lu'],
18 ['pc_asm_overlap', 3],
19 ['ksp_max_it', 100],
20 ['ksp_rtol', 1e-30]]
21
22 #now, go through our arguments, and write over default options.
23 for i in range(len(arguments.list)):
24 arg1 = arguments.list[i][0]
25 arg2 = arguments.list[i][1]
26 found = 0
27 for j in range(len(options)):
28 joption = options[j][0]
29 if joption == arg1:
30 joption[1] = arg2
31 options[j] = joption
32 found = 1
33 break
34 if not found:
35 #this option did not exist, add it:
36 options.append([arg1, arg2])
37
38 asmoptions = OrderedDict()
39 for j in range(len(options)):
40 asmoptions[options[j][0]]=options[j][1]
41
42 return asmoptions
Note: See TracBrowser for help on using the repository browser.