diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /math/gsurfit/gscopy.gx | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'math/gsurfit/gscopy.gx')
-rw-r--r-- | math/gsurfit/gscopy.gx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/math/gsurfit/gscopy.gx b/math/gsurfit/gscopy.gx new file mode 100644 index 00000000..9f0a6d09 --- /dev/null +++ b/math/gsurfit/gscopy.gx @@ -0,0 +1,69 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <math/gsurfit.h> +$if (datatype == r) +include "gsurfitdef.h" +$else +include "dgsurfitdef.h" +$endif + +# GSCOPY -- Procedure to copy the fit from one surface into another. + +$if (datatype == r) +procedure gscopy (sf1, sf2) +$else +procedure dgscopy (sf1, sf2) +$endif + +pointer sf1 # pointer to original surface +pointer sf2 # pointer to the new surface + +begin + if (sf1 == NULL) { + sf2 = NULL + return + } + + # allocate space for new surface descriptor + call calloc (sf2, LEN_GSSTRUCT, TY_STRUCT) + + # copy surface independent parameters + GS_TYPE(sf2) = GS_TYPE(sf1) + + switch (GS_TYPE(sf1)) { + case GS_LEGENDRE, GS_CHEBYSHEV, GS_POLYNOMIAL: + GS_NXCOEFF(sf2) = GS_NXCOEFF(sf1) + GS_XORDER(sf2) = GS_XORDER(sf1) + GS_XMIN(sf2) = GS_XMIN(sf1) + GS_XMAX(sf2) = GS_XMAX(sf1) + GS_XRANGE(sf2) = GS_XRANGE(sf1) + GS_XMAXMIN(sf2) = GS_XMAXMIN(sf1) + GS_NYCOEFF(sf2) = GS_NYCOEFF(sf1) + GS_YORDER(sf2) = GS_YORDER(sf1) + GS_YMIN(sf2) = GS_YMIN(sf1) + GS_YMAX(sf2) = GS_YMAX(sf1) + GS_YRANGE(sf2) = GS_YRANGE(sf1) + GS_YMAXMIN(sf2) = GS_YMAXMIN(sf1) + GS_XTERMS(sf2) = GS_XTERMS(sf1) + GS_NCOEFF(sf2) = GS_NCOEFF(sf1) + default: + call error (0, "GSCOPY: Unknown surface type.") + } + + # set space pointers to NULL + GS_XBASIS(sf2) = NULL + GS_YBASIS(sf2) = NULL + GS_MATRIX(sf2) = NULL + GS_CHOFAC(sf2) = NULL + GS_VECTOR(sf2) = NULL + GS_COEFF(sf2) = NULL + GS_WZ(sf2) = NULL + + # restore coefficient array + $if (datatype == r) + call calloc (GS_COEFF(sf2), GS_NCOEFF(sf2), TY_REAL) + $else + call calloc (GS_COEFF(sf2), GS_NCOEFF(sf2), TY_DOUBLE) + $endif + call amov$t (COEFF(GS_COEFF(sf1)), COEFF(GS_COEFF(sf2)), GS_NCOEFF(sf2)) +end |