/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:12 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_dsbasd s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dsbasd.h" /* program DRDSBASD *>> 1996-07-09 DRDSBASD Krogh Format changes for conversion to C. *>> 1994-10-19 DRDSBASD Krogh Changes to use M77CON *>> 1993-01-12 DRDSBASD CLL @ JPL *>> 1992-11-12 CLL @ JPL *>> 1992-11-04 CLL @ JPL * Demo driver for DSBASD, DSBASI, DSDIF, DSFIND, DSVALA. * ------------------------------------------------------------------ *--D replaces "?": DR?SBASD, ?SBASD, ?SBASI, ?SDIF, ?SFIND, ?SVALA * ------------------------------------------------------------------ */ /* PARAMETER translations */ #define IDERIV 2 #define KORDER 4 #define NCOEF 6 #define NDERIV 3 #define X 0.4e0 #define X1 0.1e0 #define X2 0.9e0 /* end of PARAMETER translations */ int main( ) { long int i, j1, j2, left, mode; double basi[NCOEF], bderiv[KORDER], bdif[NCOEF*NDERIV + 1], bvals[KORDER], svalue[NDERIV + 1]; static double tknots[KORDER + NCOEF]={0.0e0,0.0e0,0.0e0,0.0e0, 0.3e0,0.8e0,1.0e0,1.0e0,1.0e0,1.0e0}; static double bcoef[NCOEF]={0.1e0,0.4e0,0.2e0,-0.3e0,-0.5e0,-0.2e0}; /* OFFSET Vectors w/subscript range: 1 to dimension */ double *const Basi = &basi[0] - 1; double *const Bcoef = &bcoef[0] - 1; double *const Bderiv = &bderiv[0] - 1; double *const Bdif = &bdif[0] - 1; double *const Bvals = &bvals[0] - 1; double *const Svalue = &svalue[0] - 1; double *const Tknots = &tknots[0] - 1; /* end of OFFSET VECTORS */ /* ------------------------------------------------------------------ */ printf(" DRDSBASD.. Demo driver for\n DSBASD, DSBASI, DSDIF, DSFIND, DSVALA.\n KORDER =%2d, NCOEF =%2d", KORDER, NCOEF); printf("\n TKNOTS() ="); for (i = 1; i <= (KORDER + NCOEF); i++) { printf("%5.1f", Tknots[i]); } printf("\n"); printf(" Using DSFIND with X = %5.1f\n", X); left = 1; dsfind( tknots, KORDER, NCOEF + 1, X, &left, &mode ); printf(" LEFT = %2ld, MODE =%2ld\n", left, mode); printf(" Using DSBASD with IDERIV = 0\n"); dsbasd( KORDER, left, tknots, X, 0, bvals ); printf(" Values at X of basis functions indexed from %2ld to %2ld", left + 1 - KORDER, left); printf("\n "); for (i = 1; i <= KORDER; i++) { printf("%12.6f", Bvals[i]); } printf("\n"); printf(" Using DSBASD with IDERIV =%2d\n", IDERIV); dsbasd( KORDER, left, tknots, X, IDERIV, bderiv ); printf(" Values at X of 2nd deriv of basis functions indexed from %2ld to %2ld", left + 1 - KORDER, left); printf("\n "); for (i = 1; i <= KORDER; i++) { printf("%12.5f", Bderiv[i]); } printf("\n"); printf(" Using DSBASI with X1 = %5.1f and X2 = %5.1f\n", X1, X2); j1 = 1; j2 = 1; dsbasi( KORDER, NCOEF, tknots, X1, X2, &j1, &j2, basi ); printf(" J1 =%2ld, J2 =%2ld", j1, j2); printf("\n Integrals from X1 to X2 of basis functions:\n "); for (i = 1; i <= NCOEF; i++) { printf("%11.6f", Basi[i]); } printf("\n"); printf(" Using DSDIF and DSVALA with NDERIV =%2d", NDERIV); printf(" and\n BCOEF() = "); for (i = 1; i <= NCOEF; i++) { printf("%5.1f", Bcoef[i]); } printf("\n"); dsdif( KORDER, NCOEF, tknots, bcoef, NDERIV, bdif ); dsvala( KORDER, NCOEF, tknots, NDERIV, bdif, X, svalue ); printf(" Values of derivs 0 through %2d", NDERIV); printf(" at X: \n "); for (i = 1; i <= (NDERIV + 1); i++) { printf("%11.6f", Svalue[i]); } printf("\n"); exit(0); } /* end of function */