Skip to content

Commit a2d4281

Browse files
committed
add small interface to Petsc options
1 parent e4d4597 commit a2d4281

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/PETSc.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ include("petsc_ksp.jl")
225225
# -------------------------------------
226226
include("petsc_pc.jl")
227227

228+
#--------------------------------------
229+
include("petsc_options.jl")
230+
228231
end # end module
229232

230233

src/petsc_options.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Interacting with the Petsc Options Database
2+
export PetscOptionsSetValue, PetscOptionsView, PetscSetOptions
3+
4+
5+
typealias PetscViewer Ptr{Void}
6+
7+
function PetscOptionsSetValue(arg1::AbstractString,arg2::AbstractString)
8+
ccall((:PetscOptionsSetValue,petsc),PetscErrorCode,(Cstring, Cstring),arg1,arg2)
9+
end
10+
11+
function PetscOptionsView(arg1::PetscViewer=C_NULL)
12+
ccall((:PetscOptionsView,petsc),PetscErrorCode,(PetscViewer,),arg1)
13+
end
14+
15+
"""
16+
Convenience wrapper for using a dictionary to set options
17+
"""
18+
function PetscSetOptions(opts::Dict)
19+
20+
for (key, value) in opts
21+
PetscOptionsSetValue(key, value)
22+
end
23+
24+
end
25+
26+

0 commit comments

Comments
 (0)