communicate_and_merge_spawns Subroutine

public subroutine communicate_and_merge_spawns(MaxIndex, iter_data, tSingleProc)

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: MaxIndex
type(fcimc_iter_data), intent(inout) :: iter_data
logical, intent(in) :: tSingleProc

Contents


Source Code

    subroutine communicate_and_merge_spawns(MaxIndex, iter_data, tSingleProc)

        integer, intent(out) :: MaxIndex
        type(fcimc_iter_data), intent(inout) :: iter_data
        logical, intent(in) :: tSingleProc
        integer(kind=n_int), pointer :: PointTemp(:, :)
        type(timer), save :: Compress_time

        ! This routine will send all the newly-spawned particles to their
        ! correct processor.
        call SendProcNewParts(MaxIndex, tSingleProc)

        ! CompressSpawnedList works on SpawnedParts arrays, so swap the pointers around.
        PointTemp => SpawnedParts2
        SpawnedParts2 => SpawnedParts
        SpawnedParts => PointTemp

        if (tAutoAdaptiveShift) then
            call SendSpawnInfo(tSingleProc)
            PointTemp => SpawnInfo2
            SpawnInfo2 => SpawnInfo
            SpawnInfo => PointTemp
        end if
        Compress_time%timer_name = 'Compression interface'
        call set_timer(Compress_time, 20)

        ! Now we want to order and compress the spawned list of particles.
        ! This will also annihilate the newly spawned particles amongst themselves.
        ! MaxIndex will change to reflect the final number of unique determinants in the newly-spawned list,
        ! and the particles will end up in the spawnedSign/SpawnedParts lists.
        if (tSimpleInit) then
            call CompressSpawnedList_simple(MaxIndex, iter_data)
        else
            call CompressSpawnedList(MaxIndex, iter_data)
        end if

        if (tAllConnsPureInit) call set_conn_init_space_flags_slow(SpawnedParts, MaxIndex)

        call halt_timer(Compress_time)

    end subroutine communicate_and_merge_spawns