type_variable_shift Subroutine

private subroutine type_variable_shift(self, reverse)

Type Bound

type_variable

Arguments

Type IntentOptional Attributes Name
class(type_variable), intent(inout) :: self
logical, intent(in), optional :: reverse

Called by

proc~~type_variable_shift~~CalledByGraph proc~type_variable_shift type_variable%type_variable_shift proc~shift_type_ftdss type_ftdss%shift_type_ftdss proc~shift_type_ftdss->proc~type_variable_shift proc~shift_type_thermal_crs shift_type_thermal_crs proc~shift_type_thermal_crs->proc~type_variable_shift interface~shift_type_thermal_crs type_thermal_crs%shift_type_thermal_crs interface~shift_type_thermal_crs->proc~shift_type_thermal_crs

Source Code

    subroutine type_variable_shift(self, reverse)
        class(type_variable), intent(inout) :: self
        logical, intent(in), optional :: reverse
        logical :: do_reverse

        do_reverse = .false.
        if (present(reverse)) then
            do_reverse = reverse
        end if

        if (do_reverse) then
            if (self%rank > 0) then
                self%pre(:) = self%old(:, 1)
                ! 履歴を左にシフト (old(:,1) <--- old(:,2), ...)
                if (self%rank > 1) then
                    self%old(:, 1:self%rank - 1) = self%old(:, 2:self%rank)
                end if
                ! 空いた最後の履歴をクリア
                self%old(:, self%rank) = 0.0d0
            end if

        else
            self%pre(:) = self%new(:)
            if (self%rank > 0) then
                ! 履歴を右にシフト (old(:,2) <--- old(:,1), ...)
                if (self%rank > 1) then
                    self%old(:, 2:self%rank) = self%old(:, 1:self%rank - 1)
                end if
                self%old(:, 1) = self%pre(:)
            end if
        end if

    end subroutine type_variable_shift