Changeset e083829 for src/main/aggr.F90


Ignore:
Timestamp:
03/05/11 13:48:20 (2 years ago)
Author:
Oleg Batrashev <ogbash@…>
Branches:
master, external
Children:
e8c8f58
Parents:
ea465d3
git-author:
Oleg Batrashev <ogbash@…> (03/05/11 13:48:20)
git-committer:
Oleg Batrashev <ogbash@…> (03/05/11 13:48:20)
Message:

Get rid of CoarseMtx_ and Restrict in pcg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/aggr.F90

    rea465d3 re083829  
    9292#endif 
    9393 
    94   type(SpMtx)    :: AC  !< coarse matrix 
    95   type(SpMtx)    :: Restrict !< Restriction matrix (for operation) 
    9694  type(SumOfInversedSubMtx) :: B_RCS !< B matrix for the Robust Coarse Spaces 
    9795  !type(SpMtx)    :: Rest_cmb !< Restriction matrix (for coarse matrix build) 
     
    124122  integer,pointer :: aggrnum(:) 
    125123  integer :: nagr 
    126   ! Parallel coarse level 
    127   !type(CoarseData) :: CP%cdat --  
    128124 
    129125  ! Init DOUG 
     
    157153    endif 
    158154     
     155    CP = CoarsePreconditioner_New() 
    159156    ! Testing coarse matrix and aggregation through it: 
    160157    if (numprocs>1) then 
     158      CP%type = COARSE_PRECONDITIONER_TYPE_SMOOTH 
    161159      allocate(aggrnum(D%mesh%nlf)) 
    162160      nagr = P%fAggr%inner%nagr 
     
    170168      call SpMtx_unscale(D%A) 
    171169 
    172       call IntRestBuild(D%A,P%fAggr%inner,Restrict,D%A_ghost) 
    173       CS = CoarseSpace_Init(Restrict) 
     170      call IntRestBuild(D%A,P%fAggr%inner,CP%R,D%A_ghost) 
     171      CS = CoarseSpace_Init(CP%R) 
    174172      call CoarseData_Copy(CP%cdat,CP%cdat_vec) 
    175       call CoarseSpace_Expand(CS,Restrict,D%mesh,CP%cdat) 
    176       call CoarseMtxBuild(D%A,CP%cdat%LAC,Restrict,D%mesh%ninner,D%A_ghost) 
    177       call KeepGivenRowIndeces(Restrict, (/(i,i=1,P%fAggr%inner%nagr)/)) 
     173      call CoarseSpace_Expand(CS,CP%R,D%mesh,CP%cdat) 
     174      call CoarseMtxBuild(D%A,CP%cdat%LAC,CP%R,D%mesh%ninner,D%A_ghost) 
     175      call KeepGivenRowIndeces(CP%R, (/(i,i=1,P%fAggr%inner%nagr)/)) 
    178176 
    179177      if (sctls%verbose>3.and.CP%cdat%LAC%nnz<400) then 
    180         write(stream,*)'Restrict (local) is:==================' 
    181         call SpMtx_printRaw(A=Restrict) 
     178        write(stream,*)'CP%R (local) is:==================' 
     179        call SpMtx_printRaw(A=CP%R) 
    182180        write(stream,*)'A coarse (local) is:==================' 
    183181        call SpMtx_printRaw(A=CP%cdat%LAC) 
     
    186184    else  
    187185      ! non-parallel 
    188       call IntRestBuild(D%A,P%fAggr%inner,Restrict) 
     186      call IntRestBuild(D%A,P%fAggr%inner,CP%R) 
    189187 
    190188      if (sctls%coarse_method<=1) then ! if not specified or ==1 
    191          call CoarseMtxBuild(D%A,AC,Restrict,D%mesh%ninner) 
     189        CP%type = COARSE_PRECONDITIONER_TYPE_SMOOTH 
     190        call CoarseMtxBuild(D%A,CP%AC,CP%R,D%mesh%ninner) 
    192191 
    193192      else if (sctls%coarse_method==2) then 
    194          ! use the Robust Coarse Spaces algorithm 
    195          B_RCS = CoarseProjectionMtxsBuild(D%A,Restrict,P%fAggr%inner%nagr) 
     193        ! use the Robust Coarse Spaces algorithm 
     194        CP%type = COARSE_PRECONDITIONER_TYPE_ROBUST 
     195 
     196         B_RCS = CoarseProjectionMtxsBuild(D%A,CP%R,P%fAggr%inner%nagr) 
    196197         allocate(rhs_1(D%A%nrows)) 
    197198         allocate(g(D%A%ncols)) 
     
    204205         end if 
    205206 
    206          call RobustRestrictMtxBuild(B_RCS,g,Restrict) 
    207          call CoarseMtxBuild(D%A,AC,Restrict,D%mesh%ninner) 
     207         call RobustRestrictMtxBuild(B_RCS,g,CP%R) 
     208         call CoarseMtxBuild(D%A,CP%AC,CP%R,D%mesh%ninner) 
    208209 
    209210      else 
     
    212213      endif 
    213214            
    214       if (sctls%verbose>3.and.AC%nnz<400) then 
     215      if (sctls%verbose>3.and.CP%AC%nnz<400) then 
    215216        write(stream,*)'A coarse is:==================' 
    216         call SpMtx_printRaw(A=AC) 
     217        call SpMtx_printRaw(A=CP%AC) 
    217218      endif 
    218219    endif 
     
    220221    ! coarse aggregates 
    221222    if (numprocs==1) then 
    222       call Partitionings_CreateCoarse(P,D,AC) 
     223      call Partitionings_CreateCoarse(P,D,CP%AC) 
    223224      !call Aggrs_readFile_coarse(P%cAggr, "aggregates.txt") 
    224225 
     
    283284     ! Preconditioned conjugate gradient 
    284285     t1 = MPI_WTIME() 
    285      if (sctls%levels==2) then 
    286        write(stream,*)'calling pcg_weigs with coarse matrix' 
    287        call pcg_weigs(A=D%A,b=D%rhs,x=xl,Msh=D%mesh,finePrec=FP,coarsePrec=CP,it=it,cond_num=cond_num, & 
    288             A_interf_=D%A_ghost, & 
    289             CoarseMtx_=AC,Restrict=Restrict, & 
     286     write(stream,*)'calling pcg_weigs' 
     287     call pcg_weigs(A=D%A,b=D%rhs,x=xl,Msh=D%mesh,& 
     288          finePrec=FP,coarsePrec=CP,& 
     289          it=it,cond_num=cond_num, A_interf_=D%A_ghost, & 
    290290            refactor_=.true.) 
    291      else 
    292        write(stream,*)'calling pcg_weigs' 
    293        call pcg_weigs(D%A, D%rhs, xl, D%mesh,FP,CP,it,cond_num, & 
    294             A_interf_=D%A_ghost, refactor_=.true.) 
    295      endif 
    296291     t=MPI_WTIME()-t1 
    297292     write(stream,*) 'time spent in pcg():',t 
Note: See TracChangeset for help on using the changeset viewer.