H.1.3 Valid_State_Monomial Procedure

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

  function Valid_State_Monomial (Monomial) result(Valid)

    ! Input variables.

    ! Variable to be checked.
    type(Monomial_type), intent(in) :: Monomial  

    ! Output variables.

    type(logical) :: Valid             ! Logical state.


    ! Start out true.

    Valid = .true.

    ! Check for association of pointered internals.

    Valid = Valid .and. ASSOCIATED(Monomial%Mesh)
    Valid = Valid .and. ASSOCIATED(Monomial%Structure)
    if (.not.Valid) return

    ! Check for validity of internals.

    Valid = Valid .and. Initialized(Monomial)
    Valid = Valid .and. Valid_State(Monomial%Coefficient)
    Valid = Valid .and. Valid_State(Monomial%Delta_t)
    Valid = Valid .and. Valid_State(Monomial%Equation)
    Valid = Valid .and. Valid_State(Monomial%Exponent)
    Valid = Valid .and. Valid_State(Monomial%Locus)
    Valid = Valid .and. Valid_State(Monomial%Name)
    Valid = Valid .and. Valid_State(Monomial%NEquations)
    Valid = Valid .and. Valid_State(Monomial%Phi_k)
    if (Monomial%Derivative) then 
      Valid = Valid .and. Valid_State(Monomial%Phi_n)
    end if
    Valid = Valid .and. Valid_State(Monomial%Variable)
    if (.not.Valid) return

    ! Checks on the validity of Monomial.

    Valid = Valid .and. &
            (Monomial%Equation .InInterval. (/ 1, Monomial%NEquations /))

  end function Valid_State_Monomial

Michael L. Hall