The main documentation of the Valid_State_Assembled_Vector Procedure contains additional explanation of this code listing.
function Valid_State_Assembled_Vector (AV) result(Valid) ! Input variables. ! Variable to be checked. type(Assembled_Vector_type), intent(in) :: AV ! Output variables. type(logical) :: Valid ! Logical state. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Start out true. Valid = .true. ! Check for association of pointered internals. Valid = Valid .and. ASSOCIATED(AV%Structure) if (.not.Valid) return ! Check for validity of internals. Valid = Valid .and. Initialized(AV) Valid = Valid .and. Valid_State(AV%Dimensionality) Valid = Valid .and. Valid_State(AV%Dimensions) Valid = Valid .and. Valid_State(AV%NValues_Total) Valid = Valid .and. Valid_State(AV%Name) Valid = Valid .and. Valid_State(AV%Structure) select case (AV%Dimensionality) case (1) Valid = Valid .and. Valid_State(AV%Values1) case (2) Valid = Valid .and. Valid_State(AV%Values2) case (3) Valid = Valid .and. Valid_State(AV%Values3) case (4) Valid = Valid .and. Valid_State(AV%Values4) !case (-1) ! Valid = Valid .and. Valid_State(AV%ValuesRR) end select Valid = Valid .and. Valid_State(AV%Version) if (.not.Valid) return ! Checks on the validity of AV. select case (AV%Dimensionality) case (1) Valid = Valid .and. AV%NValues_Total * delta_PE_IO_PE == SIZE(AV%Values1) Valid = Valid .and. ALL(AV%Dimensions == SHAPE(AV%Values1)) case (2) Valid = Valid .and. AV%NValues_Total * delta_PE_IO_PE == SIZE(AV%Values2) Valid = Valid .and. ALL(AV%Dimensions == SHAPE(AV%Values2)) case (3) Valid = Valid .and. AV%NValues_Total * delta_PE_IO_PE == SIZE(AV%Values3) Valid = Valid .and. ALL(AV%Dimensions == SHAPE(AV%Values3)) case (4) Valid = Valid .and. AV%NValues_Total * delta_PE_IO_PE == SIZE(AV%Values4) Valid = Valid .and. ALL(AV%Dimensions == SHAPE(AV%Values4)) !case (-1) ! Valid = Valid .and. AV%NValues_Total == SIZE(AV%ValuesRR) end select return end function Valid_State_Assembled_Vector