G.3.3 Valid_State_Solver Procedure

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

  function Valid_State_Solver (Solver) result(Valid)

    ! Use association information.

    use Caesar_Numbers_Module, only: zero 

    ! Input variables.

    ! Variable to be checked.
    type(Solver_type), intent(in) :: Solver  

    ! Output variables.

    type(logical) :: Valid             ! Logical state.

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

    ! Start out true.

    Valid = .true.

    ! Check for validity of internals.

    Valid = Valid .and. Initialized(Solver)
    Valid = Valid .and. Valid_State(Solver%Epsilon)
    Valid = Valid .and. Valid_State(Solver%LAMG_levout)
    Valid = Valid .and. Valid_State(Solver%Maximum_Iterations)
    Valid = Valid .and. Valid_State(Solver%Stopping_Test)
    if (.not.Valid) return

    ! Checks on the validity of Solver.

    Valid = Valid .and. (Solver%Package == 'LAMG')
          ! .or. Solver%Package == 'Other Package'
    Valid = Valid .and. Solver%Epsilon >= zero
    Valid = Valid .and. Solver%Maximum_Iterations >= 0
    Valid = Valid .and. (Solver%Stopping_Test == '||r||/||b|| < Eps')
          ! .or. Solver%Stopping_Test == 'Other Test'

    return
  end function Valid_State_Solver



Michael L. Hall