diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /math/iminterp/asirestore.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'math/iminterp/asirestore.x')
-rw-r--r-- | math/iminterp/asirestore.x | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/math/iminterp/asirestore.x b/math/iminterp/asirestore.x new file mode 100644 index 00000000..7c6c81d0 --- /dev/null +++ b/math/iminterp/asirestore.x @@ -0,0 +1,50 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "im1interpdef.h" +include <math/iminterp.h> + +# ASIRESTORE -- Procedure to restore the interpolant stored by ASISAVE +# for use by ASIEVAL, ASIVECTOR, ASIDER and ASIGRL. + +procedure asirestore (asi, interpolant) + +pointer asi # interpolant descriptor +real interpolant[ARB] # array containing the interpolant + +int interp_type, i, nconv +pointer cptr + +begin + interp_type = int (ASI_SAVETYPE(interpolant)) + if (interp_type < 1 || interp_type > II_NTYPES) + call error (0, "ASIRESTORE: Unknown interpolant type.") + + # Allocate the interpolant descriptor structure and restore + # interpolant parameters. + + call malloc (asi, LEN_ASISTRUCT, TY_STRUCT) + ASI_TYPE(asi) = interp_type + ASI_NSINC(asi) = nint (ASI_SAVENSINC(interpolant)) + ASI_NINCR(asi) = nint (ASI_SAVENINCR(interpolant)) + ASI_SHIFT(asi) = ASI_SAVESHIFT(interpolant) + ASI_PIXFRAC(asi) = ASI_SAVEPIXFRAC(interpolant) + ASI_NCOEFF(asi) = nint (ASI_SAVENCOEFF(interpolant)) + ASI_OFFSET(asi) = nint (ASI_SAVEOFFSET(interpolant)) + ASI_BADVAL(asi) = ASI_SAVEBADVAL(interpolant) + + # Allocate space for and restore coefficients. + call malloc (ASI_COEFF(asi), ASI_NCOEFF(asi), TY_REAL) + cptr = ASI_COEFF(asi) - 1 + do i = 1, ASI_NCOEFF(asi) + COEFF(cptr+i) = interpolant[ASI_SAVECOEFF+i] + + # Allocate space for and restore the look-up tables. + if (ASI_NINCR(asi) > 0) { + nconv = 2 * ASI_NSINC(asi) + 1 + call malloc (ASI_LTABLE(asi), nconv * ASI_NINCR(asi), TY_REAL) + cptr = ASI_LTABLE(asi) - 1 + do i = 1, nconv * ASI_NINCR(asi) + LTABLE(cptr+i) = interpolant[ASI_SAVECOEFF+ASI_NCOEFF(asi)+i] + } else + ASI_LTABLE(asi) = NULL +end |