CD-Doc:
C.
CD-end


C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LDM_SPDXY        **
C**************************
C
CD-Routine: Routine to Get All SPD... Parameter Values - LDM_SPDXY
C This routine enables all the parameters related to using a polynomial
C based spatial distortion to be retrieved in one call and should be
C used where several such parameter values are required and where efficiency
C of retrieval is important.
CD-end
CD-Fortran:
      SUBROUTINE LDM_SPDXY (IPACK, IPLATE, SPD_XY, 
     +                      NSPDX, SPDX_MIN, SPDX_MAX, SXVAL,
     +                      NSPDY, SPDY_MIN, SPDY_MAX, SYVAL,
     +                      MAXDIM, IERR, ERRSTR)
CD-end
      INCLUDE 'implicit_none.finc'
C
C Purpose: Get current values of all SPD parameters; convenience routine
C
C Author:  John W. Campbell, December 1993
C
C Arguments:
C
      INTEGER IPACK
      INTEGER IPLATE
      REAL SPD_XY
      INTEGER NSPDX
      REAL SPDX_MIN
      REAL SPDX_MAX
      REAL SXVAL(*)
      INTEGER NSPDY
      REAL SPDY_MIN
      REAL SPDY_MAX
      REAL SYVAL(*)
      INTEGER MAXDIM
      INTEGER IERR
      CHARACTER*(*) ERRSTR

CD-Parameters:
C  IPACK      i (R)   Pack number (explicit)
C  IPLATE     i (R)   Plate number (explicit)
C  SPD_XY     r (W)   Returns spdxy correction factor
C  NSPDX      i (W)   Returns polynomial order SPDX_N
C  SPDX_MIN   r (W)   Returns lower x chebyshev polynomial bound
C  SPDX_MAX   r (W)   Returns upper x chebyshev polynomial bound
C  SXVAL()    r (W)   Returns polynomial coefficients for x (see MAXDIM)
C  NSPDY      i (W)   Returns polynomial order SPDY_N
C  SPDY_MIN   r (W)   Returns lower y chebyshev polynomial bound
C  SPDY_MAX   r (W)   Returns upper y chebyshev polynomial bound
C  SYVAL()    r (W)   Returns polynomial coefficients for y (see MAXDIM)
C  MAXDIM     i (R)   Maximum dimension of SXVAL, SYVAL arrays (Note: only
C                     MAXDIM coefficients will be returned if this is less
C                     than the LDM limit which may be found using the
C                     LDM_SPDMAX function.
C  IERR       i (W)   Error flag = 0 OK
C                                =-1 Invalid pack number
C                                =-2 Invalid plate number
C  ERRSTR     c (W)   Error string if error found
CD-end
C====== GLOBALS:
C
      INCLUDE 'ldm_data.finc'
      EXTERNAL LDM_BDAT
C
C====== LOCALS:
C
      INTEGER IFLAG
      INTEGER ND
      INTEGER I
      INTEGER N
C
C-------------------------------------------------------------------------------
C
      CALL LDM_CHK_GPL (IPACK, IPLATE, IERR, ERRSTR)
      IF (IERR.NE.0) RETURN
      SPD_XY = SPDXY(IPACK,IPLATE)
      NSPDX = SPDXN(IPACK,IPLATE)
      SPDX_MIN = SPDXMIN(IPACK,IPLATE)
      SPDX_MAX = SPDXMAX(IPACK,IPLATE)
      NSPDY = SPDYN(IPACK,IPLATE)
      SPDY_MIN = SPDYMIN(IPACK,IPLATE)
      SPDY_MAX = SPDYMAX(IPACK,IPLATE)
      N = LDM_MAXSPD
      IF (N.GT.MAXDIM) N = MAXDIM
      DO 100 I = 1, N
         SXVAL(I) = SPDX(IPACK,IPLATE,I)
         SYVAL(I) = SPDY(IPACK,IPLATE,I)
100   CONTINUE
      RETURN
      END
