|
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 00022 module master_thread 00023 00024 use DOUG_utils 00025 use Mesh_class 00026 use ElemMtxs_class 00027 use SpMtx_mods 00028 use DenseMtx_mod 00029 00030 implicit none 00031 00032 include 'globals_partng.F90' 00033 00034 contains 00035 00036 !------------------ 00037 ! master() 00038 !------------------ 00039 subroutine master() 00040 !use globals, only : stream, mctls, MPI_fkind, numprocs, D_MASTER 00041 implicit none 00042 00043 type(Mesh) :: Msh 00044 type(ElemMtxs) :: E 00045 type(SpMtx) :: A 00046 00047 integer :: ierr 00048 ! Partitioning 00049 integer :: nparts ! number of parts to partition a mesh 00050 integer, dimension(6) :: part_opts = (/0,0,0,0,0,0/) 00051 00052 ! Master will participate in calculations as well 00053 nparts = numprocs 00054 00055 if (isslave()) return 00056 write(stream,*) 00057 write(stream,*) 'master thread' 00058 00059 if (D_MSGLVL > 1) & 00060 call MasterCtrlData_print() 00061 00062 if (sctls%input_type == DCTL_INPUT_TYPE_ELEMENTAL) then 00063 00064 ! Create and init Mesh object 00065 Msh = Mesh_newInitFromFile(trim(mctls%info_file)) 00066 call Mesh_readFromFile(Msh, & 00067 fnFreelists = trim(mctls%freedom_lists_file), & 00068 fnCoords = trim(mctls%coords_file), & 00069 fnFreemap = trim(mctls%freemap_file)) 00070 call Mesh_printInfo(Msh) 00071 !!$ 00072 !!$ ! Build dual graph (Graph object is a data field in Mesh class) 00073 !!$ call Mesh_buildGraphDual(Msh) 00074 !!$ 00075 !!$ ! Plots mesh' dual graph 00076 !!$ ! TODO: include 1-, 2-node boundary elements 00077 !!$ call Mesh_pl2D_plotGraphDual(Msh) 00078 !!$ ! Mesh & its Dual Graph 00079 !!$ call Mesh_pl2D_plotMesh(Msh, D_PLPLOT_INIT) 00080 !!$ call Mesh_pl2D_plotGraphDual(Msh, D_PLPLOT_END) 00081 !!$ 00082 !!$ ! Partition graph 00083 !!$ !call Mesh_partitionDual(Msh, nparts, D_PART_PMETIS, part_opts) 00084 !!$ !call Mesh_partitionDual(Msh, nparts, D_PART_KMETIS, part_opts) 00085 !!$ call Mesh_partitionDual(Msh, nparts, D_PART_VKMETIS, part_opts) 00086 !!$ 00087 !!$ ! Draw colored partitoined graph 00088 !!$ !call Mesh_pl2D_plotMesh(Msh, D_PLPLOT_INIT) 00089 !!$ call Mesh_pl2D_plotGraphParted(Msh) 00090 !!$ 00091 !!$ ! Plot partitions of the mesh 00092 !!$ ! NB: Check for multivariable case! TODO 00093 !!$ call Mesh_pl2D_Partition(Msh) 00094 ! Partition with Dual Graph upon it 00095 !!$ call Mesh_pl2D_Partition(Msh, D_PLPLOT_INIT) 00096 !!$ call Mesh_pl2D_plotGraphDual(Msh, D_PLPLOT_END) 00097 !!$ 00098 !!$ ! TODO 00099 !!$ !call Mesh_findNeighbrs(Msh, 2) 00100 !!$ 00101 !!$ ! Destroy previously created graph (purely to save memory) 00102 !!$ ! (If it is not killed here or somewere else Mesh_Destroy() 00103 !!$ ! will kill it any way) 00104 !!$ call Mesh_destroyGraph(Msh) 00105 00106 ! Create and init ElemMtxs object 00107 E = ElemMtxs_New() 00108 call ElemMtxs_Init(E, Msh%nell, Msh%mfrelt) 00109 call ElemMtxs_readFileElemMatrs(E, Msh%nfrelt, trim(mctls%elemmat_rhs_file)) 00110 00111 00112 ! Distribute E according to partitioned mesh 00113 00114 ! Assemble sparse matrix 00115 call SpMtx_assembleFromElem(A, E, Msh) 00116 00117 00118 if (D_MSGLVL > 4) then 00119 call SpMtx_PrintMat(A) 00120 call SpMtx_PrintRaw(A) 00121 end if 00122 00123 ! Destroy objects 00124 call Mesh_Destroy(Msh) 00125 call ElemMtxs_Destroy(E) 00126 call SpMtx_Destroy(A) 00127 00128 else 00129 call DOUG_abort('[master] : Unrecognised input type.', -1) 00130 end if 00131 00132 end subroutine master 00133 00134 end module master_thread
1.7.3-20110217