C******************** START FILE MOMIND3.FOR ; GROUP MOMIND3 *************
C---------------------------------------------------------------------
C  MOMIND3
C   GIVEN THE TIME INDEX RETURN THE INDICES TO: THE 0TH R MOMENT
C     AND THE 0th  Y MOMENT OF THE BDY MOMENTS
C     FOURIER EXPANSION.
 
 
      SUBROUTINE MOMIND3(d, IT,IR1,IR2,IY1,IY2)
 
 
C   (BACKGROUND)
C     THE PLASMA BDY IS REPRESENTED AS A FOURIER MOMENTS EXPANSION
C   THE TIME DEPENDENT MOMENTS ARE READ BY TRDAT IN 1 3-D UFILE ".MRY" (OR
C   TIME INDEPENDENT BDY MOMENTS SPECIFIED BY NAMELIST).
C     THIS DATA IS INTERPOLATED TO A FIXED TIME GRID COVERING THE
C   ACTUAL TIME OF EXPERIMENT TO BE ANALYZED BY TRANSP.  THE
C   INTERPOLATED DATA IS STORED IN TRANSP COMMON ARRAY DATBUF.
C   TRDAT WRITES OUT AN IMAGE OF THE COMMON BLOCK CONTAINING DATBUF
C   WHICH IS READ BY TRANSP TO MAKE AN ACTUAL RUN
C
C     THIS ROUTINE HELPS LOOK UP THE INTERPOLATED MOMENTS DATA.
C      03/25/94 tbt Made from MOMIND
 
      use trdatbuf_obj
      IMPLICIT NONE
      type (trdatbuf) :: d
C
C  PASSED INPUT-- IT= DESIRED TIME INDEX
C  COMMON INPUT:
C   DATBUF  DATA BUFFER
C     MOMENTS DATA STORED TIME CONTIGUOUS, I.E.
C     0TH MOMENT AT ALL TIMES, THEN 1ST MOMENT AT ALL TIME, ETC.
C   NMOMD  NUMBER OF MOMENTS STORED IN DATBUF
C   NTIME2  NUMBER OF TIME PTS FOR MOMENTS AND 2D DATA IN DATBUF
C   LMOMD  ADDRESS OF FIRST WORD OF MOMENTS DATA IN DATBUF
C
C  PASSED OUTPUT
 
C   IR1    ADDRESS OF 0th R MOMENT
C          (IR1+1 ADDRESS TO 1st R MOMENT, ...)
C   IY1    ADDRESS OF 0th Y MOMENT
C          (IY1+1 ADDRESS TO 1st Y MOMENT, ...)
C
C---------------------------------
C
!============
! idecl:  explicitize implicit INTEGER declarations:
      INTEGER ir1,ir2,iy1,iy2,it,itm1
!============
      ITM1=IT-1
C
      IR1=D%LMOMD+ITM1
      IR2=IR1+D%NTIME2*(D%NMOMD+1)
      IY1=IR1+(D%NMOMD+1)*D%NTIME2*2
      IY2=IR1+(D%NMOMD+1)*D%NTIME2*3
C
      RETURN
      END
C******************** END FILE MOMIND3.FOR ; GROUP MOMIND3 ***************
! 19jan2003 fgtok -s r8_precision.sub all.sub "r8con.csh conversion"
