NAG Library Manual, Mark 30.3
Interfaces:  FL   CL   CPP   AD 

NAG AD Library Introduction
Example description
    Program g01ha_p0w_fe

!     G01HA_P0W_F Example Program Text
!     Mark 30.3 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use iso_c_binding, Only: c_ptr
      Use nagad_library, Only: g01ha_p0w_f
      Use nag_library, Only: nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Type (c_ptr)                     :: ad_handle
      Real (Kind=nag_wp)               :: p, rho, x, y
      Integer                          :: i, ifail, n
!     .. Executable Statements ..
      Write (nout,*) 'G01HA_P0W_F Example Program Results'

!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n

      Write (nout,*)
      Write (nout,*)
      Write (nout,99998) 'x', 'y', 'rho', 'p'

      ifail = 0
      Do i = 1, n
        Read (nin,*) x, y, rho

        ifail = 0
        Call g01ha_p0w_f(ad_handle,x,y,rho,p,ifail)

        Write (nout,99999) x, y, rho, p
      End Do
99999 Format (1X,1P,7E11.2)
99998 Format (1X,A4,A11,A13,A9,A15,A11,A13)

    End Program g01ha_p0w_fe