D.3.3 Valid_State_Base_Structure Procedure

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

  function Valid_State_Base_Structure (Structure) result(Valid)

    ! Input variables.

    ! Variable to be checked.
    type(Base_Structure_type), intent(in) :: Structure 

    ! Output variables.

    type(logical) :: Valid       ! Logical state.

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

    ! Start out true.

    Valid = .true.

    ! Check for validity of internals.

    Valid = Valid .and. Initialized(Structure)
    Valid = Valid .and. Valid_State(Structure%Length_Vector)
    Valid = Valid .and. Valid_State(Structure%Locus)
    Valid = Valid .and. Valid_State(Structure%Length_Total)
    Valid = Valid .and. Valid_State(Structure%Length_PE)
    Valid = Valid .and. Valid_State(Structure%Last_PE)
    Valid = Valid .and. Valid_State(Structure%First_PE)
    if (.not.Valid) return

    ! Checks on the validity of Structure.

    Valid = Valid .and. &
            Structure%Length_Total == SUM(Structure%Length_Vector)
    Valid = Valid .and. &
            Structure%Length_PE == Structure%Length_Vector(this_PE)
    Valid = Valid .and. &
            Structure%Last_PE == SUM(Structure%Length_Vector(1:this_PE))
    Valid = Valid .and. &
            Structure%First_PE == Structure%Last_PE - Structure%Length_PE + 1
    Valid = Valid .and. Structure%Range_PE(1) == Structure%First_PE
    Valid = Valid .and. Structure%Range_PE(2) == Structure%Last_PE

    return
  end function Valid_State_Base_Structure



Michael L. Hall