| ********** state ******************** | this subroutine reads and interpolates the jpl planetary ephemeris file | calling sequence parameters: | input: | et dp julian ephemeris epoch at which interpolation is wanted. | list 12-word integer array specifying what interpolation | is wanted for each of the bodies on the file. | list(i)=
| 646 | | for nutations and librations. angle unit is always radians.) |
| 647 | */ |
| 648 | static int state(double et, int32 *list, int do_bary, |
| 649 | double *pv, double *pvsun, double *nut, char *serr) |
| 650 | { |
| 651 | int i, j, k; |
| 652 | int32 nseg; |
| 653 | off_t64 flen, nb; |
| 654 | double *buf = js->buf; |
| 655 | double aufac, s, t, intv, ts[4]; |
| 656 | int32 nrecl, ksize; |
| 657 | int32 nr; |
| 658 | double et_mn, et_fr; |
| 659 | int32 *ipt = js->eh_ipt; |
| 660 | char ch_ttl[252]; |
| 661 | static TLS int32 irecsz; |
| 662 | static TLS int32 nrl, lpt[3], ncoeffs; |
| 663 | size_t nrd; /* unused, removes compile warnings */ |
| 664 | if (js->jplfptr == NULL) { |
| 665 | ksize = fsizer(serr); /* the number of single precision words in a record */ |
| 666 | nrecl = 4; |
| 667 | if (ksize == NOT_AVAILABLE) |
| 668 | return NOT_AVAILABLE; |
| 669 | irecsz = nrecl * ksize; /* record size in bytes */ |
| 670 | ncoeffs = ksize / 2; /* # of coefficients, doubles */ |
| 671 | /* ttl = ephemeris title, e.g. |
| 672 | * "JPL Planetary Ephemeris DE404/LE404 |
| 673 | * Start Epoch: JED= 625296.5-3001 DEC 21 00:00:00 |
| 674 | * Final Epoch: JED= 2817168.5 3001 JAN 17 00:00:00c */ |
| 675 | nrd = fread((void *) ch_ttl, 1, 252, js->jplfptr); |
| 676 | if (nrd != 252) return NOT_AVAILABLE; |
| 677 | /* cnam = names of constants */ |
| 678 | nrd = fread((void *) js->ch_cnam, 1, 2400, js->jplfptr); |
| 679 | if (nrd != 2400) return NOT_AVAILABLE; |
| 680 | /* ss[0] = start epoch of ephemeris |
| 681 | * ss[1] = end epoch |
| 682 | * ss[2] = segment size in days */ |
| 683 | nrd = fread((void *) &js->eh_ss[0], sizeof(double), 3, js->jplfptr); |
| 684 | if (nrd != 3) return NOT_AVAILABLE; |
| 685 | if (js->do_reorder) |
| 686 | reorder((char *) &js->eh_ss[0], sizeof(double), 3); |
| 687 | /* ncon = number of constants */ |
| 688 | nrd = fread((void *) &js->eh_ncon, sizeof(int32), 1, js->jplfptr); |
| 689 | if (nrd != 1) return NOT_AVAILABLE; |
| 690 | if (js->do_reorder) |
| 691 | reorder((char *) &js->eh_ncon, sizeof(int32), 1); |
| 692 | /* au = astronomical unit */ |
| 693 | nrd = fread((void *) &js->eh_au, sizeof(double), 1, js->jplfptr); |
| 694 | if (nrd != 1) return NOT_AVAILABLE; |
| 695 | if (js->do_reorder) |
| 696 | reorder((char *) &js->eh_au, sizeof(double), 1); |
| 697 | /* emrat = earth moon mass ratio */ |
| 698 | nrd = fread((void *) &js->eh_emrat, sizeof(double), 1, js->jplfptr); |
| 699 | if (nrd != 1) return NOT_AVAILABLE; |
| 700 | if (js->do_reorder) |
| 701 | reorder((char *) &js->eh_emrat, sizeof(double), 1); |
| 702 | /* ipt[i+0]: coefficients of planet i start at buf[ipt[i+0]-1] |
| 703 | * ipt[i+1]: number of coefficients (interpolation order - 1) |
| 704 | * ipt[i+2]: number of intervals in segment */ |
| 705 | nrd = fread((void *) &ipt[0], sizeof(int32), 36, js->jplfptr); |
no test coverage detected