MODULE compute_diagnostics_mod
   USE icosa
   IMPLICIT NONE
   PRIVATE

   INTERFACE

      SUBROUTINE comp_rhodz(flag, ps, rhodz)
         IMPORT
         LOGICAL, INTENT(IN) :: flag
         REAL(rstd), INTENT(IN)  :: ps(:)
         REAL(rstd), INTENT(INOUT) :: rhodz(:, :)
      END SUBROUTINE comp_rhodz

      SUBROUTINE comp_pression(ps, p, offset)
         IMPORT
         INTEGER, INTENT(IN) :: offset
         REAL(rstd), INTENT(IN) :: ps(:)
         REAL(rstd), INTENT(OUT) :: p(:, :)
      END SUBROUTINE comp_pression

      SUBROUTINE comp_temperature(pmid, q, temp)
         IMPORT
         REAL(rstd), INTENT(IN)    :: pmid(:, :)
         REAL(rstd), INTENT(IN)    :: q(:, :, :)
         REAL(rstd), INTENT(INOUT) :: temp(:, :)
      END SUBROUTINE comp_temperature

      SUBROUTINE comp_velocity(Phi, rhodz, u, W, F_el, uh, uz)
         IMPORT
         REAL(rstd), INTENT(IN)  :: Phi(:, :), u(:, :), rhodz(:, :), W(:, :)
         REAL(rstd), INTENT(OUT) :: F_el(:, :), uh(:, :), uz(:, :)
      END SUBROUTINE comp_velocity

      SUBROUTINE comp_un2ulonlat(un, ulon, ulat, scale)
         IMPORT
         REAL(rstd), INTENT(IN)  :: un(:, :)
         REAL(rstd), INTENT(OUT) :: ulon(:, :), ulat(:, :)
         REAL(rstd), INTENT(IN)  :: scale
      END SUBROUTINE comp_un2ulonlat

      SUBROUTINE comp_vorticity(ue, vort)
         IMPORT
         REAL(rstd), INTENT(IN)  :: ue(:, :)
         REAL(rstd), INTENT(OUT) :: vort(:, :)
      END SUBROUTINE comp_vorticity

      SUBROUTINE comp_divergence(ue, div)
         IMPORT
         REAL(rstd), INTENT(IN)  :: ue(:, :)
         REAL(rstd), INTENT(OUT) :: div(:, :)
      END SUBROUTINE comp_divergence

      SUBROUTINE comp_hydro_press(rhodz, theta_rhodz, ps, p)
         IMPORT
         REAL(rstd), INTENT(IN)  :: rhodz(:, :)
         REAL(rstd), INTENT(IN)  :: theta_rhodz(:, :, :)
         REAL(rstd), INTENT(OUT) :: ps(:)
         REAL(rstd), INTENT(OUT) :: p(:, :)
      END SUBROUTINE comp_hydro_press

   END INTERFACE

   PROCEDURE(comp_rhodz), POINTER, SAVE :: compute_rhodz => NULL()
   PROCEDURE(comp_pression), POINTER, SAVE :: compute_pression => NULL(), compute_pression_mid => NULL()
   PROCEDURE(comp_temperature), POINTER, SAVE :: compute_temperature => NULL()
   PROCEDURE(comp_velocity), POINTER, SAVE :: compute_velocity => NULL()
   PROCEDURE(comp_un2ulonlat), POINTER, SAVE :: compute_un2ulonlat => NULL()
   PROCEDURE(comp_vorticity), POINTER, SAVE :: compute_vorticity => NULL()
   PROCEDURE(comp_divergence), POINTER, SAVE :: compute_divergence => NULL()
   PROCEDURE(comp_hydro_press), POINTER, SAVE :: compute_hydrostatic_pressure => NULL()

   PUBLIC :: compute_rhodz, compute_pression, compute_pression_mid, compute_temperature, &
             compute_velocity, compute_un2ulonlat, compute_vorticity, compute_divergence, &
             compute_hydrostatic_pressure

END MODULE compute_diagnostics_mod
