barotropic_state_destroy Subroutine

private subroutine barotropic_state_destroy(this)

Tear down host allocations. Call exit_data first — destroying a still-device-mapped state leaks device memory silently.

Type Bound

barotropic_state_t

Arguments

Type IntentOptional Attributes Name
class(barotropic_state_t), intent(inout) :: this

Source Code

   subroutine barotropic_state_destroy(this)
      !! Tear down host allocations. Call `exit_data` first — destroying a
      !! still-device-mapped state leaks device memory silently.
      class(barotropic_state_t), intent(inout) :: this
      this%is_init = .false.
      if (allocated(this%h)) deallocate (this%h)
      if (allocated(this%b)) deallocate (this%b)
      if (allocated(this%u_face_x)) deallocate (this%u_face_x)
      if (allocated(this%hu_face_x)) deallocate (this%hu_face_x)
      if (allocated(this%v_face_y)) deallocate (this%v_face_y)
      if (allocated(this%hv_face_y)) deallocate (this%hv_face_y)
      if (allocated(this%mass_flux_x)) deallocate (this%mass_flux_x)
      if (allocated(this%mass_flux_y)) deallocate (this%mass_flux_y)
      if (allocated(this%flux_h)) deallocate (this%flux_h)
      if (allocated(this%h0)) deallocate (this%h0)
      if (allocated(this%u_face_x0)) deallocate (this%u_face_x0)
      if (allocated(this%v_face_y0)) deallocate (this%v_face_y0)
   end subroutine barotropic_state_destroy