Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInspiral 5.0.3.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInspiralNextTemplate.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 David Churches, Duncan Brown, Jolien Creighton
3*
4* This program is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation; either version 2 of the License, or
7* (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with with program; see the file COPYING. If not, write to the
16* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17* MA 02110-1301 USA
18*/
19
20#include <lal/LALInspiralBank.h>
21
22/**
23 * \ingroup LALInspiralBank_h
24 * \brief Routine to compute the parameters of the template next to the
25 * current template, but in the positive \f$\tau_{2(3)}\f$ axis.
26 * \author Sathyaprakash, B. S.
27 *
28 * The coarse grid algorithm works by starting at one corner of the
29 * parameter space, incrementing along positive \f$\tau_0\f$ direction,
30 * with increments determined by the local value of the metric,
31 * till the boundary of the parameter space is reached. It then gets back to
32 * the starting point and increments along positive \f$\tau_{2(3)}\f$
33 * direction, with an increment defined by the metric defined locally;
34 * it starts at the first point inside the parameter space but
35 * \e consistent with a square lattice. This routine is called each
36 * time a translation along the \f$\tau_{2(3)}\f$ direction is required.
37 */
38void LALInspiralNextTemplate(LALStatus *status, /**< LAL status pointer */
39 InspiralBankParams *bankPars, /**< [out] the parameters of the bank at the next grid point; the point may, indeed, lay outside */
40 InspiralMetric metric /**< [in] the value of the metric which would allow computation of the next lattice point (in the \f$\tau_{2(3)}\f$ direction) */
41 )
42{
43
44 REAL8 x0tmp, myphi, theta;
45 INT4 k;
46
49 ASSERT (bankPars, status, LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL);
50 ASSERT (bankPars->dx0 != 0, status, LALINSPIRALBANKH_ESIZE, LALINSPIRALBANKH_MSGESIZE);
51
52 myphi = fabs(atan(bankPars->dx1/bankPars->dx0));
53 theta = metric.theta;
54 if (theta > myphi) {
55 x0tmp = bankPars->x0 + bankPars->dx0 * cos(theta);
56 k = floor(x0tmp/bankPars->dx0);
57 bankPars->x0 = x0tmp - k * bankPars->dx0;
58 } else if (theta > 0 && theta < myphi) {
59 x0tmp = bankPars->x0 - bankPars->dx1 * sin(theta);
60 k = floor(x0tmp/bankPars->dx0);
61 bankPars->x0 = (k+1) * bankPars->dx0 - x0tmp;
62 } else if (-theta < myphi) {
63 x0tmp = bankPars->x0 - bankPars->dx1 * sin(theta);
64 k = floor(x0tmp/bankPars->dx0);
65 bankPars->x0 = x0tmp - k * bankPars->dx0;
66 } else {
67 x0tmp = bankPars->x0 - bankPars->dx1 * cos(theta);
68 k = floor(x0tmp/bankPars->dx0);
69 bankPars->x0 = (k+1) * bankPars->dx0 - x0tmp;
70 }
73}
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
double theta
double REAL8
int32_t INT4
void LALInspiralNextTemplate(LALStatus *status, InspiralBankParams *bankPars, InspiralMetric metric)
Routine to compute the parameters of the template next to the current template, but in the positive ...
#define LALINSPIRALBANKH_ENULL
Null pointer.
#define LALINSPIRALBANKH_ESIZE
Invalid input range.
This is a structure needed in the inner workings of the LALInspiralCreateCoarseBank code.
REAL8 dx0
increment in the x0-direction
REAL8 dx1
increment in the x1-direction
REAL8 x0
the first coordinate, chosen to be always
Structure to store metric at various points the signal manifold.
REAL8 theta
Angle from tau0 to semi-major axis of the ellipse.