np_assign Subroutine

public subroutine np_assign(n1, n2)

Defines how to assign NeutralPopulation to eachother

Arguments

TypeIntentOptionalAttributesName
type(NeutralPopulation), intent(inout) :: n1
type(NeutralPopulation), intent(in) :: n2

Calls

proc~~np_assign~~CallsGraph proc~np_assign np_assign proc~ind2sub ind2sub proc~np_assign->proc~ind2sub proc~npr_assign npr_assign proc~np_assign->proc~npr_assign proc~init_reservoir init_reservoir proc~npr_assign->proc~init_reservoir interface~randu randu proc~init_reservoir->interface~randu

Called by

proc~~np_assign~~CalledByGraph proc~np_assign np_assign interface~assignment(=) assignment(=) interface~assignment(=)->proc~np_assign

Contents

Source Code


Source Code

subroutine np_assign(n1, n2)
    !+ Defines how to assign [[NeutralPopulation]] to eachother
    type(NeutralPopulation), intent(in) :: n2
    type(NeutralPopulation), intent(inout) :: n1

    integer :: i, j, k, ic, ind(3), nx, ny, nz

    if(.not.allocated(n1%dens)) then
        nx = size(n2%dens,2); ny = size(n2%dens,3); nz = size(n2%dens,4)
        allocate(n1%dens(nlevs,nx,ny,nz), source=n2%dens)
    else
        n1%dens = n2%dens
    endif

    do ic=1,beam_grid%ngrid
        call ind2sub(beam_grid%dims,ic,ind)
        i = ind(1) ; j = ind(2) ; k = ind(3)
        if (n2%res(i,j,k)%n.ne.0) then
            call npr_assign(n1%res(i,j,k), n2%res(i,j,k))
        endif
    enddo

end subroutine np_assign