The main documentation of the Finalize_Multi_Mesh Procedure contains additional explanation of this code listing.
subroutine Finalize_Multi_Mesh (Mesh, status) ! Use associations. use Caesar_Flags_Module, only: uninitialized_flag ! Input/Output variable. ! Multi_Mesh to be finalized. type(Multi_Mesh_type), intent(inout) :: Mesh ! Output variable. type(Status_type), intent(out), optional :: status ! Exit status. ! Internal variables. type(Status_type), dimension(4) :: deallocate_status ! Deallocation Status. type(Status_type) :: consolidated_status ! Consolidated Status. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Verify requirements. VERIFY(Valid_State(Mesh),7) ! Mesh is valid. ! Unset initialization flag. Mesh%Initialized = uninitialized_flag ! Set deallocation status. call Initialize (deallocate_status) call Initialize (consolidated_status) ! ### This procedure could use some work. All mesh variables ! ### are not finalized here yet. ! Finalize internals. !NULLIFY(Mesh%One_Structure) !NULLIFY(Mesh%Many_Structure) !NULLIFY(Mesh%Many_of_One_Index) !select case (Mesh%A_Dimensionality) !case (1) ! call Finalize (Mesh%Values1, deallocate_status(1)) !case (2) ! call Finalize (Mesh%Values2, deallocate_status(1)) !case (3) ! call Finalize (Mesh%Values3, deallocate_status(1)) !case (4) ! call Finalize (Mesh%Values4, deallocate_status(1)) !case (5) ! call Finalize (Mesh%Values5, deallocate_status(1)) !case (-1) ! call Finalize (Mesh%ValuesRR, deallocate_status(1)) !end select !call Finalize (Mesh%A_Dimensionality, deallocate_status(2)) !call Finalize (Mesh%Dimensionality, deallocate_status(3)) call Finalize (Mesh%NDimensions, deallocate_status(1)) call Finalize (Mesh%Name, deallocate_status(2)) call Finalize (Mesh%Version, deallocate_status(3)) if (Mesh%Orthogonality == 'Orthogonal') then call Finalize (Mesh%Lengths, deallocate_status(4)) end if ! 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(Mesh),7) ! Mesh is not valid. return end subroutine Finalize_Multi_Mesh