to_original.F90 Source File


This file depends on

sourcefile~~to_original.f90~~EfferentGraph sourcefile~to_original.f90 to_original.F90 sourcefile~reordering.f90 reordering.F90 sourcefile~to_original.f90->sourcefile~reordering.f90 sourcefile~adjacency_node.f90 adjacency_node.F90 sourcefile~reordering.f90->sourcefile~adjacency_node.f90 sourcefile~core.f90 core.F90 sourcefile~reordering.f90->sourcefile~core.f90 sourcefile~element.f90 element.F90 sourcefile~reordering.f90->sourcefile~element.f90 sourcefile~adjacency_node.f90->sourcefile~core.f90 sourcefile~allocate.f90 allocate.F90 sourcefile~core.f90->sourcefile~allocate.f90 sourcefile~check_range.f90 check_range.F90 sourcefile~core.f90->sourcefile~check_range.f90 sourcefile~deallocate.f90 deallocate.F90 sourcefile~core.f90->sourcefile~deallocate.f90 sourcefile~error.f90 error.F90 sourcefile~core.f90->sourcefile~error.f90 sourcefile~fortran_utils.f90 fortran_utils.F90 sourcefile~core.f90->sourcefile~fortran_utils.f90 sourcefile~string_utils.f90 string_utils.F90 sourcefile~core.f90->sourcefile~string_utils.f90 sourcefile~types.f90 types.F90 sourcefile~core.f90->sourcefile~types.f90 sourcefile~unique.f90 unique.F90 sourcefile~core.f90->sourcefile~unique.f90 sourcefile~vtk.f90 vtk.F90 sourcefile~core.f90->sourcefile~vtk.f90 sourcefile~vtk_constants.f90 vtk_constants.F90 sourcefile~core.f90->sourcefile~vtk_constants.f90 sourcefile~element.f90->sourcefile~core.f90 sourcefile~input.f90 input.F90 sourcefile~element.f90->sourcefile~input.f90 sourcefile~allocate.f90->sourcefile~error.f90 sourcefile~deallocate.f90->sourcefile~error.f90 sourcefile~memory_stats_wrapper.f90 memory_stats_wrapper.F90 sourcefile~fortran_utils.f90->sourcefile~memory_stats_wrapper.f90 sourcefile~signal_flag_wrapper.f90 signal_flag_wrapper.F90 sourcefile~fortran_utils.f90->sourcefile~signal_flag_wrapper.f90 sourcefile~system_info_wrapper.f90 system_info_wrapper.F90 sourcefile~fortran_utils.f90->sourcefile~system_info_wrapper.f90 sourcefile~input_interface.f90 input_interface.F90 sourcefile~input.f90->sourcefile~input_interface.f90 sourcefile~string_utils.f90->sourcefile~allocate.f90 sourcefile~array.f90 array.F90 sourcefile~types.f90->sourcefile~array.f90 sourcefile~gauss.f90 gauss.F90 sourcefile~types.f90->sourcefile~gauss.f90 sourcefile~pointer.f90 pointer.F90 sourcefile~types.f90->sourcefile~pointer.f90 sourcefile~variable.f90 variable.F90 sourcefile~types.f90->sourcefile~variable.f90 sourcefile~vector.f90 vector.F90 sourcefile~types.f90->sourcefile~vector.f90 sourcefile~unique.f90->sourcefile~allocate.f90 sourcefile~vtk.f90->sourcefile~allocate.f90 sourcefile~vtk.f90->sourcefile~deallocate.f90 sourcefile~vtk.f90->sourcefile~unique.f90 sourcefile~vtk.f90->sourcefile~vtk_constants.f90 sourcefile~vtk.f90->sourcefile~array.f90 sourcefile~vtk_wrapper.f90 vtk_wrapper.F90 sourcefile~vtk.f90->sourcefile~vtk_wrapper.f90 sourcefile~vtu_wrapper.f90 vtu_wrapper.F90 sourcefile~vtk.f90->sourcefile~vtu_wrapper.f90 sourcefile~array.f90->sourcefile~allocate.f90 sourcefile~array.f90->sourcefile~deallocate.f90 sourcefile~input_interface.f90->sourcefile~core.f90 sourcefile~project_settings.f90 project_settings.F90 sourcefile~input_interface.f90->sourcefile~project_settings.f90 sourcefile~c_utils.f90 c_utils.F90 sourcefile~memory_stats_wrapper.f90->sourcefile~c_utils.f90 sourcefile~signal_flag.f90 signal_flag.F90 sourcefile~signal_flag_wrapper.f90->sourcefile~signal_flag.f90 sourcefile~system_info_wrapper.f90->sourcefile~c_utils.f90 sourcefile~variable.f90->sourcefile~allocate.f90 sourcefile~c_utils.f90->sourcefile~signal_flag.f90 sourcefile~memory_stats.f90 memory_stats.F90 sourcefile~c_utils.f90->sourcefile~memory_stats.f90 sourcefile~system_info.f90 system_info.F90 sourcefile~c_utils.f90->sourcefile~system_info.f90 sourcefile~project_settings.f90->sourcefile~core.f90

Source Code

submodule(domain_reordering) reordering_to_original
    implicit none

contains

    !================================================================!
    ! CM/RCM ordering -> original ordering
    !================================================================!
    module subroutine to_original_values_int32(self, vector_reordered, vector_original)
        implicit none
        class(type_reordering), intent(in) :: self
        integer(int32), intent(in) :: vector_reordered(:)
        integer(int32), intent(inout) :: vector_original(:)

        integer(int32) :: i

        if (size(vector_reordered) /= self%num_nodes .or. size(vector_original) /= self%num_nodes) error stop "Size mismatch"
        if (self%algorithm_name == "none") then
            vector_original(:) = vector_reordered(:)
            return
        end if
        if (.not. self%is_reordered_perm) error stop "'perm' not ready. Call 'reorder' first."

        do i = 1, self%num_nodes
            vector_original(self%perm(i)) = vector_reordered(i)
        end do

    end subroutine to_original_values_int32

    module subroutine to_original_values_real64(self, vector_reordered, vector_original)
        implicit none
        class(type_reordering), intent(in) :: self
        real(real64), intent(in) :: vector_reordered(:)
        real(real64), intent(inout) :: vector_original(:)

        integer(int32) :: i

        if (size(vector_reordered) /= self%num_nodes .or. size(vector_original) /= self%num_nodes) error stop "Size mismatch"
        if (self%algorithm_name == "none") then
            vector_original(:) = vector_reordered(:)
            return
        end if
        if (.not. self%is_reordered_perm) error stop "'perm' not ready. Call 'reorder' first."

        do i = 1, self%num_nodes
            vector_original(self%perm(i)) = vector_reordered(i)
        end do

    end subroutine to_original_values_real64

    module subroutine to_original_index(self, index_reordered, index_original)
        implicit none
        class(type_reordering), intent(in) :: self
        integer(int32), intent(in) :: index_reordered
        integer(int32), intent(inout) :: index_original

        if (self%algorithm_name == "none") then
            index_original = index_reordered
            return
        end if
        if (.not. self%is_reordered_perm) error stop "'perm' not ready. Call 'reorder' first."

        index_original = self%perm(index_reordered)

    end subroutine to_original_index

    module subroutine to_original_indices(self, indices_reordered, indices_original)
        implicit none
        class(type_reordering), intent(in) :: self
        integer(int32), intent(in) :: indices_reordered(:)
        integer(int32), intent(inout) :: indices_original(:)

        integer(int32) :: i

        if (size(indices_reordered) /= size(indices_original)) error stop "Size mismatch"
        if (self%algorithm_name == "none") then
            indices_original(:) = indices_reordered(:)
            return
        end if

        if (.not. self%is_reordered_perm) error stop "'perm' not ready. Call 'reorder' first."

        do i = 1, size(indices_reordered)
            indices_original(i) = self%perm(indices_reordered(i))
        end do

    end subroutine to_original_indices

end submodule reordering_to_original