|
DOUG 0.2
|
00001 ! DOUG - Domain decomposition On Unstructured Grids 00002 ! Copyright (C) 1998-2006 Faculty of Computer Science, University of Tartu and 00003 ! Department of Mathematics, University of Bath 00004 ! 00005 ! This library is free software; you can redistribute it and/or 00006 ! modify it under the terms of the GNU Lesser General Public 00007 ! License as published by the Free Software Foundation; either 00008 ! version 2.1 of the License, or (at your option) any later version. 00009 ! 00010 ! This library is distributed in the hope that it will be useful, 00011 ! but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 ! Lesser General Public License for more details. 00014 ! 00015 ! You should have received a copy of the GNU Lesser General Public 00016 ! License along with this library; if not, write to the Free Software 00017 ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ! or contact the authors (University of Tartu, Faculty of Computer Science, Chair 00019 ! of Distributed Systems, Liivi 2, 50409 Tartu, Estonia, http://dougdevel.org, 00020 ! mailto:info(at)dougdevel.org) 00021 00023 module Preconditioner_base_mod 00024 use Decomposition_mod 00025 use Distribution_base_mod 00026 use Partitioning_mod 00027 use CoarseAllgathers 00028 use globals 00029 00030 implicit none 00031 00032 ! -------- Fine preconditioner 00033 integer,parameter :: FINE_PRECONDITIONER_TYPE_NONE=0, 00034 FINE_PRECONDITIONER_TYPE_COMPLETE=1, 00035 FINE_PRECONDITIONER_TYPE_SGS=2 00036 00038 type FinePreconditioner_complete 00039 logical :: factored !< whether submatrices are factored 00040 integer :: nsubsolves !< number of subdomain solves 00041 integer, dimension(:), pointer :: subsolve_ids !< numeric object handles of (UMFPACK,...) factorizations 00042 end type FinePreconditioner_complete 00043 00045 type FinePreconditioner_sgs 00046 integer :: n_iter !< number of Gauss-Seidel iterations 00047 type(SpMtx),pointer :: As(:) !< matrices for subdomains 00048 end type FinePreconditioner_sgs 00049 00051 type FinePreconditioner 00052 integer :: type !< fine preconditioner type 00053 type(Distribution),pointer :: distr !< fine level grid and matrix 00054 type(Decomposition) :: domains !< local subdomains 00055 ! implementations 00056 !! complete 00057 type(FinePreconditioner_complete),pointer :: complete 00058 !! SGS 00059 type(FinePreconditioner_sgs),pointer :: sgs 00060 end type FinePreconditioner 00061 00062 ! -------- Coarse preconditioner 00063 integer,parameter :: COARSE_PRECONDITIONER_TYPE_NONE=0, 00064 COARSE_PRECONDITIONER_TYPE_SMOOTH=1, 00065 COARSE_PRECONDITIONER_TYPE_GEOMETRIC=2, 00066 COARSE_PRECONDITIONER_TYPE_ROBUST=3 00067 00069 type CoarsePreconditioner 00070 integer :: type !< coarse preconditioner type 00071 type(CoarseData) :: cdat !<coarse data -- includes overlap 00072 type(CoarseData) :: cdat_vec !<coarse data -- w/o overlap, for vector collects 00073 type(SpMtx) :: R !< Restriction matrix 00074 logical :: ready !< whether coarse matrix values are exchanged 00075 type(SpMtx) :: AC !< Coarse matrix 00076 00077 ! implementations 00078 !type(CoarsePreconditioner_smooth),pointer :: smooth 00079 end type CoarsePreconditioner 00080 00081 contains 00082 00083 function FinePreconditioner_New(distr) result (FP) 00084 type(Distribution),target :: distr 00085 type(FinePreconditioner) :: FP 00086 00087 FP%type = FINE_PRECONDITIONER_TYPE_NONE 00088 FP%distr => distr 00089 FP%domains = Decomposition_New() 00090 FP%complete => NULL() 00091 FP%sgs => NULL() 00092 00093 end function FinePreconditioner_New 00094 00096 subroutine FinePreconditioner_Init(FP, D, P, ol) 00097 type(FinePreconditioner),intent(inout) :: FP 00098 type(Distribution),intent(inout) :: D !< fine grid and matrix 00099 type(Partitionings),intent(in) :: P !< fine and coarse partitions 00100 integer,intent(in) :: ol !< overlap 00101 00102 integer :: nnodes_exp, nnodes, start, iPart 00103 integer,allocatable :: nodes(:) 00104 00105 FP%domains = Decomposition_New() 00106 allocate(FP%domains%subd(P%cPart%nparts)) 00107 00108 allocate(nodes(D%mesh%nlf)) 00109 call SpMtx_arrange(D%A,D_SpMtx_ARRNG_ROWS,sort=.false.) 00110 do iPart=1,P%cPart%nparts ! loop over coarse partitions 00111 start = P%cPart%starts(iPart) 00112 nnodes = P%cPart%starts(iPart+1) - start 00113 nodes(1:nnodes) = P%cPart%nodes(start:start+nnodes-1) 00114 call Add_layers(D%A%m_bound,D%A%indj,nodes,nnodes,ol,nnodes_exp) 00115 00116 ! keep indlist: 00117 allocate(FP%domains%subd(iPart)%inds(nnodes_exp)) 00118 FP%domains%subd(iPart)%ninds=nnodes_exp 00119 FP%domains%subd(iPart)%inds(1:nnodes_exp)=nodes(1:nnodes_exp) 00120 enddo 00121 deallocate(nodes) 00122 00123 end subroutine FinePreconditioner_Init 00124 00125 function CoarsePreconditioner_New() result (CP) 00126 type(CoarsePreconditioner) :: CP 00127 00128 CP%type = COARSE_PRECONDITIONER_TYPE_NONE 00129 CP%R = SpMtx_New() 00130 CP%ready = .false. 00131 CP%AC = SpMtx_New() 00132 00133 end function CoarsePreconditioner_New 00134 00135 end module Preconditioner_base_mod
1.7.3-20110217