| 1 | ! DOUG - Domain decomposition On Unstructured Grids |
|---|
| 2 | ! Copyright (C) 1998-2006 Faculty of Computer Science, University of Tartu and |
|---|
| 3 | ! Department of Mathematics, University of Bath |
|---|
| 4 | ! |
|---|
| 5 | ! This library is free software; you can redistribute it and/or |
|---|
| 6 | ! modify it under the terms of the GNU Lesser General Public |
|---|
| 7 | ! License as published by the Free Software Foundation; either |
|---|
| 8 | ! version 2.1 of the License, or (at your option) any later version. |
|---|
| 9 | ! |
|---|
| 10 | ! This library is distributed in the hope that it will be useful, |
|---|
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 13 | ! Lesser General Public License for more details. |
|---|
| 14 | ! |
|---|
| 15 | ! You should have received a copy of the GNU Lesser General Public |
|---|
| 16 | ! License along with this library; if not, write to the Free Software |
|---|
| 17 | ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 18 | ! or contact the authors (University of Tartu, Faculty of Computer Science, Chair |
|---|
| 19 | ! of Distributed Systems, Liivi 2, 50409 Tartu, Estonia, http://dougdevel.org, |
|---|
| 20 | ! mailto:info(at)dougdevel.org) |
|---|
| 21 | |
|---|
| 22 | !> Base file for preconditioner component. |
|---|
| 23 | module Preconditioner_base_mod |
|---|
| 24 | use Decomposition_mod |
|---|
| 25 | use Distribution_mod |
|---|
| 26 | use Partitioning_mod |
|---|
| 27 | use CoarseAllgathers |
|---|
| 28 | use globals |
|---|
| 29 | |
|---|
| 30 | implicit none |
|---|
| 31 | |
|---|
| 32 | ! -------- Fine preconditioner |
|---|
| 33 | |
|---|
| 34 | !> Data for the complete 1-level preconditioner |
|---|
| 35 | type FinePreconditioner_complete |
|---|
| 36 | logical :: factored !< whether submatrices are factored |
|---|
| 37 | integer :: nsubsolves !< number of subdomain solves |
|---|
| 38 | integer, dimension(:), pointer :: subsolve_ids !< numeric object handles of (UMFPACK,...) factorizations |
|---|
| 39 | end type FinePreconditioner_complete |
|---|
| 40 | |
|---|
| 41 | !> Base type for fine level preconditioner. |
|---|
| 42 | type FinePreconditioner |
|---|
| 43 | type(Distribution),pointer :: distr !< fine level grid and matrix |
|---|
| 44 | type(Decomposition) :: domains !< local subdomains |
|---|
| 45 | ! implementations |
|---|
| 46 | type(FinePreconditioner_complete),pointer :: complete |
|---|
| 47 | end type FinePreconditioner |
|---|
| 48 | |
|---|
| 49 | ! -------- Coarse preconditioner |
|---|
| 50 | integer,parameter :: COARSE_PRECONDITIONER_TYPE_NONE=0, & |
|---|
| 51 | COARSE_PRECONDITIONER_TYPE_SMOOTH=1, & |
|---|
| 52 | COARSE_PRECONDITIONER_TYPE_GEOMETRIC=2, & |
|---|
| 53 | COARSE_PRECONDITIONER_TYPE_ROBUST=3 |
|---|
| 54 | |
|---|
| 55 | !> Base type for fine level preconditioner. |
|---|
| 56 | type CoarsePreconditioner |
|---|
| 57 | integer :: type !< coarse preconditioner type |
|---|
| 58 | type(CoarseData) :: cdat !<coarse data -- includes overlap |
|---|
| 59 | type(CoarseData) :: cdat_vec !<coarse data -- w/o overlap, for vector collects |
|---|
| 60 | type(SpMtx) :: R !< Restriction matrix |
|---|
| 61 | type(SpMtx) :: AC !< Coarse matrix |
|---|
| 62 | |
|---|
| 63 | ! implementations |
|---|
| 64 | !type(CoarsePreconditioner_smooth),pointer :: smooth |
|---|
| 65 | end type CoarsePreconditioner |
|---|
| 66 | |
|---|
| 67 | contains |
|---|
| 68 | |
|---|
| 69 | function FinePreconditioner_New(distr) result (FP) |
|---|
| 70 | type(Distribution),target :: distr |
|---|
| 71 | type(FinePreconditioner) :: FP |
|---|
| 72 | |
|---|
| 73 | FP%distr => distr |
|---|
| 74 | FP%domains = Decomposition_New() |
|---|
| 75 | FP%complete => NULL() |
|---|
| 76 | |
|---|
| 77 | end function FinePreconditioner_New |
|---|
| 78 | |
|---|
| 79 | !> Initialize preconditioner with one domain for the full process region. |
|---|
| 80 | subroutine FinePreconditioner_InitFull(FP, D, ol) |
|---|
| 81 | type(FinePreconditioner),intent(inout) :: FP |
|---|
| 82 | type(Distribution),intent(inout) :: D !< fine grid and matrix |
|---|
| 83 | integer,intent(in) :: ol !< overlap |
|---|
| 84 | |
|---|
| 85 | FP%domains = Decomposition_full(D%A,D%A_ghost,D%mesh%ninner,ol) |
|---|
| 86 | |
|---|
| 87 | end subroutine FinePreconditioner_InitFull |
|---|
| 88 | |
|---|
| 89 | !> Initialize preconditioner with several subdomains from coarse aggregates. |
|---|
| 90 | subroutine FinePreconditioner_InitAggrs(FP, D, P, ol) |
|---|
| 91 | type(FinePreconditioner),intent(inout) :: FP |
|---|
| 92 | type(Distribution),intent(inout) :: D !< fine grid and matrix |
|---|
| 93 | type(Partitionings),intent(in) :: P !< fine and coarse aggregates |
|---|
| 94 | integer,intent(in) :: ol !< overlap |
|---|
| 95 | |
|---|
| 96 | FP%domains = Decomposition_from_aggrs(D%A, P%cAggr%full, P%fAggr%full, ol) |
|---|
| 97 | |
|---|
| 98 | end subroutine FinePreconditioner_InitAggrs |
|---|
| 99 | |
|---|
| 100 | function CoarsePreconditioner_New() result (CP) |
|---|
| 101 | type(CoarsePreconditioner) :: CP |
|---|
| 102 | |
|---|
| 103 | CP%type = COARSE_PRECONDITIONER_TYPE_NONE |
|---|
| 104 | |
|---|
| 105 | end function CoarsePreconditioner_New |
|---|
| 106 | |
|---|
| 107 | end module Preconditioner_base_mod |
|---|