|
DOUG 0.2
|
00001 00002 module Decomposition_mod 00003 use globals 00004 use Aggregate_mod 00005 use SpMtx_class 00006 use SpMtx_arrangement 00007 implicit none 00008 00010 type Decomposition 00011 type(indlist),dimension(:),pointer :: subd !< subdomain indices for each subdomain 00012 end type Decomposition 00013 00014 private 00015 public :: Decomposition, & 00016 Decomposition_New, & 00017 Decomposition_Destroy, & 00018 Add_layers 00019 contains 00020 00021 function Decomposition_New() result(DD) 00022 type(Decomposition) :: DD 00023 00024 DD%subd => NULL() 00025 end function Decomposition_New 00026 00027 subroutine Decomposition_Destroy(DD) 00028 type(Decomposition), intent(inout) :: DD 00029 00030 if (associated(DD%subd)) deallocate(DD%subd) 00031 end subroutine Decomposition_Destroy 00032 00034 subroutine Get_nodes(iDomain, eptnmap, nodes, nnodes) 00035 integer, intent(in) :: iDomain !< domain number 00036 integer, dimension(:), intent(in) :: eptnmap !< element to partition map 00037 integer,intent(inout) :: nodes(:) 00038 integer,intent(out) :: nnodes 00039 00040 integer i, inode 00041 00042 ! count number of nodes in the domain 00043 nnodes = count(eptnmap==iDomain) 00044 00045 inode = 0 00046 do i=1,size(eptnmap) 00047 if (eptnmap(i)==iDomain) then 00048 inode = inode+1 00049 nodes(inode) = i 00050 end if 00051 end do 00052 00053 end subroutine Get_nodes 00054 00056 subroutine Add_layers(adjBounds,adjValues,nodes,nnodes,nlayers,onnodes) 00057 integer,intent(in) :: adjBounds(:), adjValues(:) 00058 integer,intent(inout) :: nodes(:) 00059 integer,intent(in) :: nnodes, nlayers 00060 integer,intent(out) :: onnodes !< number of nodes with all layers 00061 00062 integer,dimension(:),allocatable :: frontstart !< start bound of layers 00063 integer,dimension(:),allocatable :: frontend !< end bound of layers 00064 integer,dimension(:),allocatable :: onfront 00065 integer :: node,layer,neigh,nfront,i,j 00066 00067 onnodes = nnodes 00068 allocate(frontstart(0:nlayers), frontend(0:nlayers)) 00069 allocate(onfront(size(nodes))) 00070 onfront = 0 00071 00072 ! mark inital nodes as the very first step 00073 frontstart(0)=1 00074 do i=1,nnodes 00075 node=nodes(i) 00076 onfront(node)=-1 00077 enddo 00078 nfront=nnodes 00079 frontend(0)=nfront 00080 00081 ! add nlayers to the subdomain 00082 do layer=1,nlayers 00083 frontstart(layer)=nfront 00084 do i=frontstart(layer-1),frontend(layer-1) 00085 node=nodes(i) 00086 do j=adjBounds(node),adjBounds(node+1)-1 00087 neigh=adjValues(j) 00088 if (onfront(neigh)==0) then 00089 onfront(neigh)=layer 00090 nfront=nfront+1 00091 nodes(nfront)=neigh 00092 endif 00093 enddo 00094 enddo 00095 frontend(layer)=nfront 00096 enddo 00097 00098 onnodes = frontend(nlayers) 00099 end subroutine Add_layers 00100 00101 end module Decomposition_mod
1.7.3-20110217