The main documentation of the Finalize_Mathematic_Vector Procedure contains additional explanation of this code listing.
subroutine Finalize_Mathematic_Vector (MV, status) ! Use associations. use Caesar_Flags_Module, only: uninitialized_flag ! Input/Output variable. ! Mathematic_Vector to be finalized. type(Mathematic_Vector_type), intent(inout) :: MV ! Output variables. type(Status_type), intent(out), optional :: status ! Exit status. ! Internal variables. type(integer) :: i ! Loop variable. ! Deallocation Status. type(Status_type), dimension(Number_of_OVs_in_an_MV+21) :: & deallocate_status type(Status_type) :: consolidated_status ! Consolidated Status. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Verify requirements. VERIFY(Valid_State(MV),7) ! Mathematic_Vector is valid. VERIFY(Number_of_OVs_in_an_MV==4,5) ! 4 is assumed in this procedure. ! Unset initialization flag. MV%Initialized = uninitialized_flag ! Deallocations and finalizations. ! Set deallocation status. call Initialize (deallocate_status) call Initialize (consolidated_status) ! Finalize internals. NULLIFY(MV%Structure) NULLIFY(MV%Index1) NULLIFY(MV%Index2) NULLIFY(MV%Index3) NULLIFY(MV%Index4) call Finalize (MV%Name, deallocate_status( 1)) call Finalize (MV%Average, deallocate_status( 2)) call Finalize (MV%Average_is_Updated, deallocate_status( 3)) call Finalize (MV%Infinity_Norm, deallocate_status( 4)) call Finalize (MV%Infinity_Norm_is_Updated, deallocate_status( 5)) call Finalize (MV%Maximum, deallocate_status( 6)) call Finalize (MV%Maximum_is_Updated, deallocate_status( 7)) call Finalize (MV%Minimum, deallocate_status( 8)) call Finalize (MV%Minimum_is_Updated, deallocate_status( 9)) call Finalize (MV%One_Norm, deallocate_status(10)) call Finalize (MV%One_Norm_is_Updated, deallocate_status(11)) call Finalize (MV%DV_is_Updated, deallocate_status(12)) call Finalize (MV%P_Norm, deallocate_status(13)) call Finalize (MV%P_Norm_Exponent, deallocate_status(14)) call Finalize (MV%P_Norm_is_Updated, deallocate_status(15)) call Finalize (MV%Sum, deallocate_status(16)) call Finalize (MV%Sum_is_Updated, deallocate_status(17)) call Finalize (MV%Two_Norm, deallocate_status(18)) call Finalize (MV%Two_Norm_is_Updated, deallocate_status(19)) call Finalize (MV%Values, deallocate_status(20)) do i = 1, Number_of_OVs_in_an_MV if (Initialized(MV%OV(i))) then call Finalize (MV%OV(i), deallocate_status(i+21)) end if end do if (Initialized(MV%DV)) call Finalize (MV%DV, deallocate_status(21)) ! Process status variables. consolidated_status = deallocate_status if (PRESENT(status)) then WARN_IF(Error(consolidated_status), 5) status = consolidated_status else VERIFY(Normal(consolidated_status), 5) end if call Finalize (consolidated_status) call Finalize (deallocate_status) ! Verify guarantees. VERIFY(.not.Valid_State(MV),7) ! Mathematic_Vector is not valid. return end subroutine Finalize_Mathematic_Vector