populate_coloring_result Subroutine

private subroutine populate_coloring_result(self)

Type Bound

type_coloring

Arguments

Type IntentOptional Attributes Name
class(type_coloring), intent(inout) :: self

Called by

proc~~populate_coloring_result~~CalledByGraph proc~populate_coloring_result type_coloring%populate_coloring_result proc~coloring_dsatur coloring_dsatur proc~coloring_dsatur->proc~populate_coloring_result proc~coloring_lfo coloring_lfo proc~coloring_lfo->proc~populate_coloring_result proc~coloring_welsh_powell coloring_welsh_powell proc~coloring_welsh_powell->proc~populate_coloring_result interface~coloring_dsatur type_coloring%coloring_dsatur interface~coloring_dsatur->proc~coloring_dsatur interface~coloring_lfo type_coloring%coloring_lfo interface~coloring_lfo->proc~coloring_lfo interface~coloring_welsh_powell type_coloring%coloring_welsh_powell interface~coloring_welsh_powell->proc~coloring_welsh_powell proc~initialize_type_coloring type_coloring%initialize_type_coloring proc~initialize_type_coloring->interface~coloring_dsatur proc~initialize_type_coloring->interface~coloring_lfo proc~initialize_type_coloring->interface~coloring_welsh_powell

Source Code

    subroutine populate_coloring_result(self)
        implicit none
        class(type_coloring), intent(inout) :: self
        integer(int32) :: i, j, counts, num_nodes

        num_nodes = size(self%color)
        if (num_nodes == 0) then
            self%num_colors = 0
            return
        end if

        self%num_colors = maxval(self%color)
        if (self%num_colors == 0) return

        if (allocated(self%colored)) deallocate (self%colored)
        allocate (self%colored(self%num_colors))

        do i = 1, self%num_colors
            counts = count(self%color == i)
            self%colored(i)%num_elements = counts
            if (counts > 0) then
                allocate (self%colored(i)%elements(counts))
                self%colored(i)%elements = pack([(j, j=1, num_nodes)], self%color == i)
            end if
        end do
    end subroutine populate_coloring_result