|
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 CoarsePreconditioner_geometric_mod 00024 use Preconditioner_base_mod 00025 use CoarseGrid_class 00026 use TransmitCoarse 00027 use CoarseCreateRestrict 00028 use CreateCoarseGrid 00029 use CoarseMtx_mod 00030 use Mesh_plot_mod 00031 00032 contains 00033 00034 subroutine CoarsePreconditioner_geometric_Init(CP, D) 00035 type(CoarsePreconditioner),intent(inout) :: CP 00036 type(Distribution),intent(inout) :: D 00037 00038 type(CoarseGrid) :: LC,C 00039 00040 CP%type = COARSE_PRECONDITIONER_TYPE_GEOMETRIC 00041 00042 ! Init some mandatory values if they arent given 00043 if (mctls%cutbal<=0) mctls%cutbal=1 00044 if (mctls%maxnd==-1) mctls%maxnd=500 00045 if (mctls%maxcie==-1) mctls%maxcie=75 00046 if (mctls%center_type==-1) mctls%center_type=1 ! geometric 00047 if (sctls%interpolation_type==-1) sctls%interpolation_type=1 ! multilinear 00048 sctls%smoothers=0 ! only way it works 00049 00050 C = CoarseGrid_New() 00051 if (ismaster()) then 00052 if (sctls%verbose>0) write (stream,*) "Building coarse grid" 00053 00054 call CreateCoarse(D%mesh,C) 00055 00056 if (sctls%plotting>0) then 00057 call Mesh_pl2D_plotMesh(D%mesh,D_PLPLOT_INIT) 00058 call CoarseGrid_pl2D_plotMesh(C,D_PLPLOT_END) 00059 endif 00060 00061 if (sctls%verbose>1) & 00062 write (stream,*) "Sending parts of the coarse grid to other threads" 00063 call SendCoarse(C,D%mesh,LC) 00064 00065 ! if (sctls%verbose>1) write (stream,*) "Creating a local coarse grid" 00066 ! call CoarseGrid_Destroy(LC) 00067 ! call CreateLocalCoarse(C,M,LC) 00068 00069 ! deallocating coarse grid 00070 nullify(C%coords) ! as LC uses that 00071 call CoarseGrid_Destroy(C) 00072 00073 else 00074 if (sctls%verbose>0) write (stream,*) "Recieving coarse grid data" 00075 call ReceiveCoarse(LC, D%mesh) 00076 endif 00077 if (sctls%plotting>1 .and. ismaster()) call CoarseGrid_pl2D_plotMesh(LC) 00078 00079 if (sctls%verbose>0) write (stream,*) "Creating Restriction matrix" 00080 call CreateRestrict(LC,D%mesh,CP%R) 00081 00082 if (sctls%verbose>1) write (stream,*) "Cleaning Restriction matrix" 00083 call CleanCoarse(LC,CP%R,D%mesh) 00084 00085 if (sctls%verbose>0) write (stream,*) "Building coarse matrix" 00086 call CoarseMtxBuild(D%A,CP%cdat%LAC,CP%R,D%mesh%ninner) 00087 00088 if (sctls%verbose>1) write (stream, *) "Stripping the restriction matrix" 00089 call StripRestrict(D%mesh,CP%R) 00090 00091 if (sctls%verbose>0) write (stream,*) "Transmitting local-to-global maps" 00092 00093 allocate(CP%cdat%cdisps(D%mesh%nparts+1)) 00094 CP%cdat%send=SendData_New(D%mesh%nparts) 00095 CP%cdat%lg_cfmap=>LC%lg_fmap 00096 CP%cdat%gl_cfmap=>LC%gl_fmap 00097 CP%cdat%nprocs=D%mesh%nparts 00098 CP%cdat%ngfc=LC%ngfc 00099 CP%cdat%nlfc=LC%nlfc 00100 CP%cdat%active=.true. 00101 00102 call AllSendCoarselgmap(LC%lg_fmap,LC%nlfc,D%mesh%nparts,& 00103 CP%cdat%cdisps,CP%cdat%glg_cfmap,CP%cdat%send) 00104 call AllRecvCoarselgmap(CP%cdat%send) 00105 00106 !call CoarseGrid_Destroy(LC) 00107 00108 end subroutine CoarsePreconditioner_geometric_Init 00109 00110 end module CoarsePreconditioner_geometric_mod
1.7.3-20110217