Changeset bd99c62


Ignore:
Timestamp:
12/08/10 12:36:24 (2 years ago)
Author:
Oleg Batrashev <ogbash@…>
Branches:
master, external, fix-prolong, refactor, refactor-ext, refactor-subsolvers
Children:
dd63f9f
Parents:
f2101f9
git-author:
Oleg Batrashev <ogbash@…> (12/08/10 12:36:24)
git-committer:
Oleg Batrashev <ogbash@…> (12/08/10 12:36:24)
Message:

Special Mesh allocate subroutine is excessive.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/datatypes/Mesh.F90

    r0bd2cda rbd99c62  
    243243  end function Mesh_newInit 
    244244 
    245  
    246   !---------------------------------------------------------- 
    247   !! Allocates Mesh's main data 
    248   !---------------------------------------------------------- 
    249   subroutine Mesh_allocate(M, & 
    250        nfrelt,  & 
    251        mhead,   & 
    252        freemap, & 
    253        coords,  & 
    254        eptnmap, & 
    255        freemask) 
    256     implicit none 
    257  
    258     type(Mesh), intent(in out)         :: M 
    259     logical,    intent(in),   optional :: nfrelt, mhead, freemap 
    260     logical,    intent(in),   optional :: coords, eptnmap, freemask 
    261     logical                            :: all=.false. 
    262     if (.not.present(nfrelt)    .and.& 
    263          (.not.present(mhead))  .and.& 
    264          (.not.present(freemap)).and.& 
    265          (.not.present(coords)) .and.& 
    266          (.not.present(eptnmap)) .and.& 
    267          (.not.present(freemask))) then 
    268        if (.not.associated(M%nfrelt))   allocate(M%nfrelt(M%nell)) 
    269        if (.not.associated(M%mhead))    allocate(M%mhead(M%mfrelt,M%nell)) 
    270        if (.not.associated(M%freemap))  allocate(M%freemap(M%ngf)) 
    271        if (.not.associated(M%coords))   allocate(M%coords(M%nsd,M%nnode)) 
    272        if (.not.associated(M%eptnmap))  allocate(M%eptnmap(M%nell)) 
    273        if (.not.associated(M%freemask)) allocate(M%freemask(M%ngf)) 
    274        all = .true. 
    275     end if 
    276  
    277     if (present(nfrelt)  .and.(.not.all).and.& 
    278          (.not.associated(M%nfrelt)))   allocate(M%nfrelt(M%nell)) 
    279     if (present(mhead)   .and.(.not.all).and.& 
    280          (.not.associated(M%mhead)))    allocate(M%mhead(M%mfrelt,M%nell)) 
    281     if (present(freemap) .and.(.not.all).and.& 
    282          (.not.associated(M%freemap)))  allocate(M%freemap(M%ngf)) 
    283     if (present(coords)  .and.(.not.all).and.& 
    284          (.not.associated(M%coords)))   allocate(M%coords(M%nsd,M%nnode)) 
    285     if (present(eptnmap)  .and.(.not.all).and.& 
    286          (.not.associated(M%eptnmap)))  allocate(M%eptnmap(M%nell)) 
    287     if (present(freemask).and.(.not.all).and.& 
    288          (.not.associated(M%freemask))) allocate(M%freemask(M%ngf)) 
    289  
    290   end subroutine Mesh_allocate 
    291  
    292  
    293245  !------------------------- 
    294246  !! Destructor 
     
    387339    nnode=ngf 
    388340    call Mesh_Init(M, nell, ngf, nsd, mfrelt, nnode) 
    389     call Mesh_allocate(M,coords=.true.,freemap=.true.) ! needing the coords... 
     341    allocate(M%coords(M%nsd,M%nnode),M%freemap(M%ngf)) ! needing the coords... 
    390342    M%freemap= (/ (i,i=1,ngf) /) 
    391343    do j=1,n 
     
    15031455          end do 
    15041456       else 
     1457          if (.NOT.associated(M%nfrelt)) allocate(M%nfrelt(M%nell)) 
    15051458          call MPI_RECV(M%nfrelt, M%nell, MPI_INTEGER, & 
    15061459               D_MASTER, D_TAG_MESH_NFRELT, MPI_COMM_WORLD, status, ierr) 
     
    15161469          end do 
    15171470       else 
     1471          if (.NOT.associated(M%mhead)) allocate(M%mhead(M%mfrelt,M%nell)) 
    15181472          call MPI_RECV(M%mhead, M%mfrelt*M%nell, MPI_INTEGER, & 
    15191473               D_MASTER, D_TAG_MESH_MHEAD, MPI_COMM_WORLD, status, ierr) 
     
    15291483          end do 
    15301484       else 
     1485          if (.not.associated(M%freemap)) allocate(M%freemap(M%ngf)) 
    15311486          call MPI_RECV(M%freemap, M%ngf, MPI_INTEGER, & 
    15321487               D_MASTER, D_TAG_MESH_FREEMASK, MPI_COMM_WORLD, status, ierr) 
     
    15421497          end do 
    15431498       else 
     1499          if (.not.associated(M%coords))   allocate(M%coords(M%nsd,M%nnode)) 
    15441500          call MPI_RECV(M%coords, M%nnode*M%nsd, MPI_xyzkind, & 
    15451501               D_MASTER, D_TAG_MESH_FREEMASK, MPI_COMM_WORLD, status, ierr) 
     
    15551511          end do 
    15561512       else 
     1513          if (.not.associated(M%eptnmap))  allocate(M%eptnmap(M%nell)) 
    15571514          call MPI_RECV(M%eptnmap, M%nell, MPI_INTEGER, & 
    15581515               D_MASTER, D_TAG_MESH_EPTNMAP, MPI_COMM_WORLD, status, ierr) 
     
    15921549          end do 
    15931550       else 
     1551          if (.not.associated(M%freemask)) allocate(M%freemask(M%ngf)) 
    15941552          call MPI_RECV(M%freemask, M%ngf, MPI_BYTE, & 
    15951553               D_MASTER, D_TAG_MESH_FREEMASK, MPI_COMM_WORLD, status, ierr) 
  • src/main/main_drivers.F90

    r848affb rbd99c62  
    8888    type(SpMtx),intent(in out),optional :: A_interf !< matrix at interface 
    8989 
     90    if (ismaster()) then ! MASTER 
     91       write(stream,*) 
     92       write(stream,*) 'master thread' 
     93       if (D_MSGLVL > 1) & 
     94            call MasterCtrlData_print() 
     95 
     96    else ! SLAVES 
     97       write(stream,'(a,i4,a)') 'slave [',myrank,'] thread' 
     98       if (D_MSGLVL > 1) & 
     99            call SharedCtrlData_print() 
     100    end if 
     101 
    90102    ! ======================= 
    91103    ! Mesh and its Dual Graph 
     
    93105    ! 
    94106    ! Create Mesh object 
     107 
    95108    Msh = Mesh_New() 
    96109 
    97     if (ismaster()) then ! MASTER 
    98        write(stream,*) 
    99        write(stream,*) 'master thread' 
    100  
    101        if (D_MSGLVL > 1) & 
    102             call MasterCtrlData_print() 
    103  
     110    if (ismaster()) then 
    104111       ! Initialise Mesh object 
    105112       call Mesh_initFromFile(Msh, trim(mctls%info_file)) 
    106  
    107     else ! SLAVES 
    108        write(stream,'(a,i4,a)') 'slave [',myrank,'] thread' 
    109  
    110        if (D_MSGLVL > 1) & 
    111             call SharedCtrlData_print() 
    112     end if 
     113    endif 
    113114 
    114115    ! Get from master Mesh's parameters: nell, ngf, mfrelt, nsd, nnode 
     
    116117    if (D_MSGLVL > 1) & 
    117118         call Mesh_printInfo(Msh) 
    118  
    119     ! Allocate data arrays (nfrelt, mhead, freemap, eptnmap) for mesh 
    120     call Mesh_allocate(Msh, & 
    121          nfrelt  =.true.,   & 
    122          mhead   =.true.,   & 
    123          freemap =.true.,   & 
    124          eptnmap  =.true.) 
    125119 
    126120    ! Master reads in from files: feedom lists, coordinates, freedom map 
     
    141135    ! For multi-variable problems which have more than one block 
    142136    if (sctls%number_of_blocks > 1) then 
    143        call Mesh_allocate(Msh, freemask=.true.) 
    144137       if (ismaster()) then 
    145138          call Mesh_readFromFile(Msh, & 
Note: See TracChangeset for help on using the changeset viewer.