Last change
on this file since 26661 was 26661, checked in by jdquinn, 3 years ago |
CHG: Pending translations; cleanup
|
File size:
1.2 KB
|
Line | |
---|
1 | from collections import OrderedDict
|
---|
2 | from pairoptions import pairoptions
|
---|
3 |
|
---|
4 | def asmoptions(*args):
|
---|
5 | """ASMOPTIONS - Return Additive Schwartz Method PETSc options
|
---|
6 |
|
---|
7 | Usage:
|
---|
8 | options = asmoptions
|
---|
9 | """
|
---|
10 |
|
---|
11 | # Retrieve options provided in *args
|
---|
12 | arguments = pairoptions(*args)
|
---|
13 |
|
---|
14 | options = [
|
---|
15 | ['toolkit', 'petsc'],
|
---|
16 | ['mat_type', 'mpiaij'],
|
---|
17 | ['ksp_type', 'gmres'],
|
---|
18 | ['pc_type', 'asm'],
|
---|
19 | ['sub_pc_type', 'lu'],
|
---|
20 | ['pc_asm_overlap', 3],
|
---|
21 | ['ksp_max_it', 100],
|
---|
22 | ['ksp_rtol', 1e-30]
|
---|
23 | ]
|
---|
24 |
|
---|
25 | # Now, go through our arguments, and write over default options
|
---|
26 | for i in range(len(arguments.list)):
|
---|
27 | arg1 = arguments.list[i][0]
|
---|
28 | arg2 = arguments.list[i][1]
|
---|
29 | found = 0
|
---|
30 | for j in range(len(options)):
|
---|
31 | joption = options[j][0]
|
---|
32 | if joption == arg1:
|
---|
33 | joption[1] = arg2
|
---|
34 | options[j] = joption
|
---|
35 | found = 1
|
---|
36 | break
|
---|
37 | if not found:
|
---|
38 | # This option did not exist; add it
|
---|
39 | options.append([arg1, arg2])
|
---|
40 |
|
---|
41 | asmoptions = OrderedDict()
|
---|
42 | for j in range(len(options)):
|
---|
43 | asmoptions[options[j][0]]=options[j][1]
|
---|
44 |
|
---|
45 | return asmoptions
|
---|
Note:
See
TracBrowser
for help on using the repository browser.