00001 local void print_binary_diagnostics(real t, tdyn *b, tdyn *bb, pdyn *curr)
00002 {
00003 PRC(t); PRL(b->format_label());
00004 PRL(bb->get_time());
00005 PRL(b->get_time());
00006
00007 tdyn *n = b->get_next();
00008 if (n) PRL(n->get_time());
00009
00010 real fac = 1 + bb->get_mass()
00011 / bb->get_binary_sister()->get_mass();
00012 real M = bb->get_parent()->get_mass();
00013
00014 real rbb = abs(fac*bb->get_pos());
00015 real vbb = square(fac*bb->get_vel());
00016 real ebb = 0.5*vbb - M / rbb;
00017
00018 real rb = abs(fac*b->get_pos());
00019 real vb = square(fac*b->get_vel());
00020 real eb = 0.5*vb - M / rb;
00021
00022 real rc = abs(fac*curr->get_pos());
00023 real vc = square(fac*curr->get_vel());
00024 real ec = 0.5*vc - M / rc;
00025
00026 PRI(4); PRC(rbb); PRC(vbb); PRL(ebb);
00027 PRI(4); PRC(rb); PRC(vbb); PRL(eb);
00028 PRI(4); PRC(rc); PRC(vc); PRL(ec);
00029
00030 if (n) {
00031 real rn = abs(fac*n->get_pos());
00032 real vn = square(fac*n->get_vel());
00033 real en = 0.5*vn - M / rn;
00034 PRI(4); PRC(rn); PRC(vn); PRL(en);
00035 }
00036
00037 PRI(4); PRL(-M/(2*ebb));
00038
00039 #ifndef NEW_INTERP
00040
00041
00042
00043 PRL(interpolate_pos(b, b->get_time(), bb));
00044 PRL(interpolate_pos(b, t, bb));
00045 if (n)
00046 PRL(interpolate_pos(b, n->get_time(), bb));
00047
00048 #else
00049
00050
00051
00052 vector interp_pos_time;
00053 set_interpolated_pos(b, b->get_time(), interp_pos_time, bb);
00054 PRL(interp_pos_time);
00055 vector interp_pos_t;
00056 set_interpolated_pos(b, t, interp_pos_t, bb);
00057 PRL(interp_pos_t);
00058 if (n) {
00059 vector interp_pos_ntime;
00060 set_interpolated_pos(b, n->get_time(), interp_pos_ntime, bb);
00061 PRL(interp_pos_ntime);
00062 }
00063
00064 #endif
00065
00066 real dt = t - (real)b->get_time();
00067 real dtn = 0;
00068 if (n) dtn = n->get_time() - b->get_time();
00069 cerr << "interpolation..." << endl;
00070 PRC(dt); PRL(dtn);
00071 PRL(b->get_pos());
00072 PRL(dt*b->get_vel());
00073 PRL(dt*dt*b->get_acc());
00074 PRL(dt*dt*dt*b->get_jerk());
00075 }