H.2.10 Output_Ortho_Diffusion Procedure

The main documentation of the Output_Ortho_Diffusion Procedure contains additional explanation of this code listing.

  subroutine Output_Ortho_Diffusion (Diff_Term, First, Last, Unit, Indent, &
                                     status)

    ! Input variables.

    ! Variable to be output.
    type(Ortho_Diffusion_type), intent(inout) :: Diff_Term 
    type(integer), intent(in), optional :: First    ! Extents of value data
    type(integer), intent(in), optional :: Last     !   to be output.
    type(integer), intent(in), optional :: Unit     ! Output unit.
    type(integer), optional :: Indent               ! Indentation.

    ! Output variable.

    type(Status_type), intent(out), optional :: status  ! Exit status.

    ! Internal variables.

    type(integer) :: A_First                         ! Actual first value.
    type(integer) :: A_Last                          ! Actual last value.
    type(integer) :: A_Unit                          ! Actual output unit.
    type(integer) :: A_Indent                        ! Actual indentation.
    type(character,80) :: Blanks                     ! A line of blanks.
    type(Mathematic_Vector_type) :: Coefficient_MV   ! Temp MV for Coefficient.
    type(Mathematic_Vector_type) :: Phi_MV           ! Temp MV for Phi.
    type(Status_type), dimension(2) :: allocate_status ! Allocation Status.
    type(Status_type) :: consolidated_status           ! Consolidated Status.

    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ! Verify requirements.

    VERIFY(Valid_State(Diff_Term),5)                  ! Diff_Term is valid.

    ! Set unit number.
    
    if (PRESENT(Unit)) then
      A_Unit = Unit
    else
      A_Unit = 6
    end if

    ! Set indentation.
    
    if (PRESENT(Indent)) then
      A_Indent = Indent
    else
      A_Indent = 0
    end if
    Blanks = ' '
     
    ! Set up local limits in terms of global limits.

    if (PRESENT(First)) then
      A_First = First
    else
      A_First = 1
    end if
    if (PRESENT(Last)) then
      A_Last = Last
    else
      A_Last = Length_Total(Diff_Term%Structure)
    end if

    ! Allocations and initializations.

    call Initialize (allocate_status)
    call Initialize (consolidated_status)

    ! Output Identification Info.

    if (this_is_IO_PE) then
      write (A_Unit,100) Blanks(1:A_Indent), 'Ortho_Diffusion Information:'
      write (A_Unit,101) Blanks(1:A_Indent+2), 'Name                 = ', &
                         TRIM(Diff_Term%Name)
      write (A_Unit,102) Blanks(1:A_Indent+2), 'Initialized          =', &
                         Initialized(Diff_Term)
      write (A_Unit,101) Blanks(1:A_Indent+2), 'Locus                = ', &
                         TRIM(Diff_Term%Locus)
      write (A_Unit,103) Blanks(1:A_Indent+2), 'Extrapolation        = ', &
                         Diff_Term%Extrapolation
      write (A_Unit,104) Blanks(1:A_Indent+2), 'Equation             =', &
                         Diff_Term%Equation
      write (A_Unit,104) Blanks(1:A_Indent+2), 'NEquations           =', &
                         Diff_Term%NEquations
    end if

    ! Output internal structure info.

    call Output (Diff_Term%Structure, A_Unit, 'Ortho_Diffusion Locus', &
                 A_Indent+2)

    call Initialize (Coefficient_MV, Diff_Term%Structure, &
                     'Coefficient as an MV', allocate_status(1))
    Coefficient_MV = Diff_Term%Coefficient
    call Output (Coefficient_MV, A_First, A_Last, A_Unit, A_Indent+2)
    call Finalize (Coefficient_MV)

    call Initialize (Phi_MV, Diff_Term%Structure, &
                     'Phi as an MV', allocate_status(2))
    Phi_MV = Diff_Term%Phi
    call Output (Phi_MV, A_First, A_Last, A_Unit, A_Indent+2)
    call Finalize (Phi_MV)

    ! Process status variables.

    consolidated_status = allocate_status
    if (PRESENT(status)) then
      WARN_IF(Error(consolidated_status), 5)
      status = consolidated_status
    else
      VERIFY(Normal(consolidated_status), 5)
    end if
    call Finalize (consolidated_status)
    call Finalize (allocate_status)

    ! Format statements.

    100 format (/, 2a, /)
    101 format (3a)
    102 format (2a, l2)
    103 format (2a, 1p, e13.5e3)
    104 format (2a, 1p, i4)

    ! Verify guarantees - none.

    return
  end subroutine Output_Ortho_Diffusion



Michael L. Hall