70public:
typedef long double real;
71 typedef Eagle::STA::sphericalpoint PolarPt;
72 typedef Eagle::STA::point CartesianPt;
79 CartesianPt operator()(
const PolarPt&P)
const
84 return CartesianPt( Center + r * (
sin(phi) *
Y -
cos(phi) *
X) );
87static real cosine(
const CartesianVec&l,
const CartesianVec&r)
89 return dot( l.spatial(), r.spatial() );
93 PolarPt operator()(
const CartesianPt&P, real&sinphi, real&cosphi)
const
95 CartesianVec p = P-Center;
107 real r =
norm( dist_vec );
108 cosphi = -cosine(
X,p) / r;
109 sinphi = cosine(
Y,p) / r;
111 real phi = atan2(sinphi, cosphi);
142vector3 CoordinateAxes::direction(
double sinphi,
double cosphi,
143 double u,
double du)
const
145 return (-du * sinphi + u * cosphi) *
Y +
146 ( du * cosphi + u * sinphi) *
X;
160double z = sinphi/u - cosphi/du,
161 n = sinphi/du + cosphi/u;
181public:
typedef long double real;
185 typedef STA::sphericalpoint PolarPt;
186 typedef STA::sphericalvector PolarVec;
187 typedef STA::point CartesianPt;
220 bool restart(
const real&s,
const CartesianPt&x0,
const CartesianVec&v0)
229 const point3 & Center = EQ.Center.spatial();
232 db_logf(21,
"SchwarzschildGeodesic: EQ Axis: Ray (%lg,%lg,%lg) + l (%lg,%lg,%lg) \n",
233 double( q0[0]),
double( q0[1]),
double( q0[2]),
234 double(dq0[0]),
double(dq0[1]),
double(dq0[2])
247 real l = dot(Center - q0, dq0);
251 db_logf(21,
"SchwarzschildGeodesic: EQ Axis: Closest linear approach is at lambda=%lg\n",
double(l) );
257 EQ.X = tvector4( 0, dq0);
263#define SVECP(V) double(V[V->x]),double(V[V->y]),double(V[V->z])
265 db_logf(21,
"SchwarzschildGeodesic: CLOSEPOINT: (%lg,%lg,%lg) (lambda=%lg [%lg])\n",
266 SVECP(y),
double(l),
double(l/M) );
279 real *u = initialize(2*N,s);
285 db_logf(21,
"SchwarzschildGeodesic: DIRECT VIEW with impact parameter %lg (relative %lg, mass %lg), cannot setup axis!\n",
286 double(d),
double(d/M),
double(M) );
292 EQ.Y = tvector4(0, y);
295 db_logf(21,
"SchwarzschildGeodesic: AXIS: (%lg,%lg,%lg) x (%lg,%lg,%lg) \n",
296 SVECP(EQ.X), SVECP(EQ.Y) );
301 PolarPt p0 = EQ(x0, sinphi, cosphi);
303 db_logf(21,
"SchwarzschildGeodesic: Initial point at polar coordinates (r=%lg,theta=%lg,phi=%lg)\n",
304 double(p0[p0->r]),
double(p0[p0->th]),
double(p0[p0->ph]) );
307 real phi = p0[p0.PHI];
308 real *u = initialize(2*N, phi);
314 db_logf(21,
"SchwarzschildGeodesic: sinphi=%lg cosphi=%lg d=%lg\n",
315 double(sinphi),
double(cosphi),
double(d) );
326 void Accel(real,
const real *x,
const real *v, real *d2x_ds2)
328 for(
unsigned int i=0; i<nPaths(); i++)
330 d2x_ds2[i] = 3*M*x[i]*x[i]-x[i];
334 CartesianPt position()
const
337 P = EQ.Center[P.T], 1/q(0), 0, s1();
343 CartesianVec velocity()
const
351 double r_sin_delta = du * sinphi - u * cosphi,
352 r_cos_delta = u * sinphi +du * cosphi;
354 return r_cos_delta * EQ.X + r_sin_delta * EQ.Y;
357 CartesianPt position(real phi)
const
369 CartesianVec velocity(real phi)
const
376 double r_sin_delta = du * sinphi - u * cosphi,
377 r_cos_delta = u * sinphi +du * cosphi;
379 return r_cos_delta * EQ.X + r_sin_delta * EQ.Y;
void Accel(real, const real *x, const real *v, real *d2x_ds2)
Implements the one-dimensional Schwarzschild geodesic equation .
Definition SchwarzschildGeodesic.hpp:326