G.3.5 Set_Solver_Variable Procedure

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

  subroutine Set_Solver_Variable (Solver, Variable, Real_Value, &
                                  Integer_Value, Character_Value, &

    ! Input variables.

    type(character,*), intent(in) :: Variable ! Variable name.
    ! Variable value.
    type(character,*), intent(in), optional :: Character_Value 
    type(real), intent(in), optional :: Real_Value
    type(integer), intent(in), optional :: Integer_Value
    type(logical), intent(in), optional :: Logical_Value

    ! Input/Output variables.

    type(Solver_type), intent(inout) :: Solver   ! Solver to be set.


    ! Verify requirements.

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

    ! Set Solver variables.

    if (Variable == 'Epsilon' .and. PRESENT(Real_Value)) then
      Solver%Epsilon = Real_Value

    else if (Variable == 'Maximum_Iterations' .and. &
             PRESENT(Integer_Value)) then
      Solver%Maximum_Iterations = Integer_Value

    else if (Variable == 'Stopping_Test' .and. PRESENT(Character_Value)) then
      Solver%Stopping_Test = Character_Value

    ! Set LAMG variables.

    else if (Variable == 'LAMG_levout' .and. PRESENT(Integer_Value)) then
      Solver%LAMG_levout = Integer_Value

    ! Error check.

      ! No variable match found.
    end if

    ! Verify guarantees.

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

  end subroutine Set_Solver_Variable

Michael L. Hall