!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer,
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer
!version 3 or (at your option) any later version that should be found at:
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software;
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec),
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
!

      FUNCTION VMRBCVT(liste,tblval,rval8,nele,nval,nt,mode) 7
*
#if defined (DOC)
*
***s/r VMRBCVT  -real*8 interface for real*8 function MRBCVT. 
*
*Author  : JM Belanger *CMDA/SMC Sept 2000
*Revision:
*
*Arguments: See MRBCVT code for documentation
*    Input:
*      liste
*      nele
*      nval
*      nt
*      mode
*    Output:
*
*    Input/Output
*      rval8  (mode=1/mode=0)
*      tblval (mode=0/mode=1)
*
#endif
      IMPLICIT NONE
*implicits

      integer VMRBCVT 

      integer nele,nval,nt,mode
      integer liste(nele),tblval(nele,nval,nt)
      real*8 rval8(nele,nval,nt)
*
      integer ier1,ier2,j1,j2,j3,ilen
      real rval4
      pointer (pxrval4, rval4(nele,nval,nt))
*
      integer mrbcvt
      external mrbcvt
*-----7----------------------------------------------------------------
      ilen=nele*nval*nt
      call hpalloc(pxrval4,max(1,ilen),ier1,1)

*     rval8 ---> tblval
         if (mode .eq. 1) then
         rval4(:,:,:) = rval8(:,:,:)
         ier2 = mrbcvt(liste,tblval,rval4,nele,nval,nt,mode)
      endif


*     tblval ---> rval8
      if (mode .eq. 0) then
         rval4(:,:,:)=tblval(:,:,:)
         ier2 = mrbcvt(liste,tblval,rval4,nele,nval,nt,mode)
         rval8(:,:,:) = rval4(:,:,:)
      endif

      call hpdeallc(pxrval4,ier1,1)

      vmrbcvt=ier2

      return
      end