generate_all_edges Subroutine

private subroutine generate_all_edges(num_elems, elem_ptr, elem_data, edge_i, edge_j, edge_count, istat)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: num_elems
integer(kind=int32), intent(in) :: elem_ptr(:)
integer(kind=int32), intent(in) :: elem_data(:)
integer(kind=int32), intent(out), allocatable :: edge_i(:)
integer(kind=int32), intent(out), allocatable :: edge_j(:)
integer(kind=int32), intent(out) :: edge_count
integer(kind=int32), intent(out) :: istat

Calls

proc~~generate_all_edges~~CallsGraph proc~generate_all_edges generate_all_edges interface~allocate_array allocate_array proc~generate_all_edges->interface~allocate_array proc~allocate_rank1_int16 allocate_rank1_int16 interface~allocate_array->proc~allocate_rank1_int16 proc~allocate_rank1_int32 allocate_rank1_int32 interface~allocate_array->proc~allocate_rank1_int32 proc~allocate_rank1_int64 allocate_rank1_int64 interface~allocate_array->proc~allocate_rank1_int64 proc~allocate_rank1_int8 allocate_rank1_int8 interface~allocate_array->proc~allocate_rank1_int8 proc~allocate_rank1_logical1 allocate_rank1_logical1 interface~allocate_array->proc~allocate_rank1_logical1 proc~allocate_rank1_logical4 allocate_rank1_logical4 interface~allocate_array->proc~allocate_rank1_logical4 proc~allocate_rank1_logical8 allocate_rank1_logical8 interface~allocate_array->proc~allocate_rank1_logical8 proc~allocate_rank1_real128 allocate_rank1_real128 interface~allocate_array->proc~allocate_rank1_real128 proc~allocate_rank1_real32 allocate_rank1_real32 interface~allocate_array->proc~allocate_rank1_real32 proc~allocate_rank1_real64 allocate_rank1_real64 interface~allocate_array->proc~allocate_rank1_real64 proc~allocate_rank2_int16 allocate_rank2_int16 interface~allocate_array->proc~allocate_rank2_int16 proc~allocate_rank2_int32 allocate_rank2_int32 interface~allocate_array->proc~allocate_rank2_int32 proc~allocate_rank2_int64 allocate_rank2_int64 interface~allocate_array->proc~allocate_rank2_int64 proc~allocate_rank2_int8 allocate_rank2_int8 interface~allocate_array->proc~allocate_rank2_int8 proc~allocate_rank2_logical1 allocate_rank2_logical1 interface~allocate_array->proc~allocate_rank2_logical1 proc~allocate_rank2_logical4 allocate_rank2_logical4 interface~allocate_array->proc~allocate_rank2_logical4 proc~allocate_rank2_logical8 allocate_rank2_logical8 interface~allocate_array->proc~allocate_rank2_logical8 proc~allocate_rank2_real128 allocate_rank2_real128 interface~allocate_array->proc~allocate_rank2_real128 proc~allocate_rank2_real32 allocate_rank2_real32 interface~allocate_array->proc~allocate_rank2_real32 proc~allocate_rank2_real64 allocate_rank2_real64 interface~allocate_array->proc~allocate_rank2_real64 proc~error_message error_message proc~allocate_rank1_int16->proc~error_message proc~allocate_rank1_int32->proc~error_message proc~allocate_rank1_int64->proc~error_message proc~allocate_rank1_int8->proc~error_message proc~allocate_rank1_logical1->proc~error_message proc~allocate_rank1_logical4->proc~error_message proc~allocate_rank1_logical8->proc~error_message proc~allocate_rank1_real128->proc~error_message proc~allocate_rank1_real32->proc~error_message proc~allocate_rank1_real64->proc~error_message proc~allocate_rank2_int16->proc~error_message proc~allocate_rank2_int32->proc~error_message proc~allocate_rank2_int64->proc~error_message proc~allocate_rank2_int8->proc~error_message proc~allocate_rank2_logical1->proc~error_message proc~allocate_rank2_logical4->proc~error_message proc~allocate_rank2_logical8->proc~error_message proc~allocate_rank2_real128->proc~error_message proc~allocate_rank2_real32->proc~error_message proc~allocate_rank2_real64->proc~error_message log_error log_error proc~error_message->log_error

Called by

proc~~generate_all_edges~~CalledByGraph proc~generate_all_edges generate_all_edges proc~initialize_node_adjacency type_node_adjacency%initialize_node_adjacency proc~initialize_node_adjacency->proc~generate_all_edges proc~build_node_adjacency_from_elements build_node_adjacency_from_elements proc~build_node_adjacency_from_elements->proc~initialize_node_adjacency proc~cm_reorder_method cm_reorder_method proc~cm_reorder_method->proc~build_node_adjacency_from_elements proc~rcm_reorder_method rcm_reorder_method proc~rcm_reorder_method->proc~build_node_adjacency_from_elements interface~cm_reorder_method type_reordering%cm_reorder_method interface~cm_reorder_method->proc~cm_reorder_method interface~rcm_reorder_method type_reordering%rcm_reorder_method interface~rcm_reorder_method->proc~rcm_reorder_method proc~initialize_type_reordering type_reordering%initialize_type_reordering proc~initialize_type_reordering->interface~cm_reorder_method proc~initialize_type_reordering->interface~rcm_reorder_method

Source Code

    subroutine generate_all_edges(num_elems, elem_ptr, elem_data, &
                                  edge_i, edge_j, edge_count, istat)
        integer(int32), intent(in) :: num_elems, elem_ptr(:), elem_data(:)
        integer(int32), allocatable, intent(out) :: edge_i(:), edge_j(:)
        integer(int32), intent(out) :: edge_count, istat

        integer(int32) :: i, j, k, n1, n2, start_idx, end_idx, est_edges

        istat = 0
        est_edges = size(elem_data) * 4 ! 推定サイズ
        call allocate_array(edge_i, est_edges)
        call allocate_array(edge_j, est_edges)
        edge_count = 0

        do i = 1, num_elems
            start_idx = elem_ptr(i)
            end_idx = elem_ptr(i + 1) - 1
            do j = start_idx, end_idx
                do k = j + 1, end_idx
                    edge_count = edge_count + 1
                    if (edge_count > est_edges) then
                        istat = -1; return ! メモリ見積もりエラー
                    end if
                    n1 = elem_data(j)
                    n2 = elem_data(k)
                    if (n1 < n2) then
                        edge_i(edge_count) = n1
                        edge_j(edge_count) = n2
                    else
                        edge_i(edge_count) = n2
                        edge_j(edge_count) = n1
                    end if
                end do
            end do
        end do
    end subroutine generate_all_edges