Line | |
---|
1 | from pairoptions import pairoptions
|
---|
2 |
|
---|
3 |
|
---|
4 | def 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 | return options
|
---|
Note:
See
TracBrowser
for help on using the repository browser.