forked from MODFLOW-ORG/modflow6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinearSolverFactory.F90
More file actions
42 lines (33 loc) · 992 Bytes
/
LinearSolverFactory.F90
File metadata and controls
42 lines (33 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module LinearSolverFactory
use SimModule, only: ustop
use LinearSolverBaseModule
use MatrixBaseModule
use SparseMatrixModule
use VectorBaseModule
use ImsLinearSolverModule
#if defined(__WITH_PETSC__)
use PetscSolverModule, only: create_petsc_solver
#endif
implicit none
private
public :: create_linear_solver
contains
!> @brief Factory method to create the linear solver object
!<
function create_linear_solver(solver_mode, sln_name) result(solver)
character(len=*) :: solver_mode
character(len=*) :: sln_name
class(LinearSolverBaseType), pointer :: solver
solver => null()
if (solver_mode == 'IMS') then
solver => create_ims_solver(sln_name)
return
#if defined(__WITH_PETSC__)
else if (solver_mode == 'PETSC') then
solver => create_petsc_solver(sln_name)
#endif
else
call ustop('Unsupported solver mode: '//trim(solver_mode))
end if
end function create_linear_solver
end module LinearSolverFactory