00001 /* 00002 * Copyright (C) 2007 David Churches, Duncan Brown, Jolien Creighton 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with with program; see the file COPYING. If not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00017 * MA 02111-1307 USA 00018 */ 00019 00020 /* <lalVerbatim file="LALInspiralNextTemplateCV"> 00021 Author: Sathyaprakash, B. S. 00022 $Id: LALInspiralNextTemplate.c,v 1.8 2007/06/08 14:41:42 bema Exp $ 00023 </lalVerbatim> */ 00024 00025 /* <lalLaTeX> 00026 00027 \subsection{Module \texttt{LALInspiralNextTemplate.c}} 00028 00029 Routine to compute the parameters of the template next to the 00030 current template, but in the positive $\tau_{2(3)}$ axis. 00031 00032 \subsubsection*{Prototypes} 00033 \vspace{0.1in} 00034 \input{LALInspiralNextTemplateCP} 00035 \idx{LALInspiralNextTemplate()} 00036 \begin{itemize} 00037 \item \texttt{bankPars,} Output, the parameters of the bank at the next grid point; the 00038 point may, indeed, lay outside the parameter space. 00039 \item \texttt{matrix} Input, the value of the metric which would allow computation of the 00040 next lattice point (in the $\tau_{2(3)}$ direction). 00041 \end{itemize} 00042 00043 \subsubsection*{Description} 00044 00045 The coarse grid algorithm works by starting at one corner of the 00046 parameter space, incrementing along positive $\tau_0$ direction, 00047 with increments determined by the local value of the metric, 00048 till the boundary of the parameter space is reached. It then gets back to 00049 the starting point and increments along positive $\tau_{2(3)}$ 00050 direction, with an increment defined by the metric defined locally; 00051 it starts at the first point inside the parameter space but 00052 {\it consistent} with a square lattice. This routine is called each 00053 time a translation along the $\tau_{2(3)}$ direction is required. 00054 00055 \subsubsection*{Algorithm} 00056 00057 00058 \subsubsection*{Uses} 00059 None. 00060 00061 \subsubsection*{Notes} 00062 00063 \vfill{\footnotesize\input{LALInspiralNextTemplateCV}} 00064 00065 </lalLaTeX> */ 00066 00067 00068 00069 #include <lal/LALInspiralBank.h> 00070 00071 NRCSID (LALINSPIRALNEXTTEMPLATEC, "Id: $"); 00072 00073 /* <lalVerbatim file="LALInspiralNextTemplateCP"> */ 00074 00075 void LALInspiralNextTemplate(LALStatus *status, 00076 InspiralBankParams *bankPars, 00077 InspiralMetric metric) 00078 { /* </lalVerbatim> */ 00079 00080 REAL8 x0tmp, myphi, theta; 00081 INT4 k; 00082 00083 INITSTATUS (status, "LALInspiralNextTemplate", LALINSPIRALNEXTTEMPLATEC); 00084 ATTATCHSTATUSPTR(status); 00085 ASSERT (bankPars, status, LALINSPIRALBANKH_ENULL, LALINSPIRALBANKH_MSGENULL); 00086 ASSERT (bankPars->dx0 != 0, status, LALINSPIRALBANKH_ESIZE, LALINSPIRALBANKH_MSGESIZE); 00087 00088 myphi = fabs(atan(bankPars->dx1/bankPars->dx0)); 00089 theta = metric.theta; 00090 if (theta > myphi) { 00091 x0tmp = bankPars->x0 + bankPars->dx0 * cos(theta); 00092 k = floor(x0tmp/bankPars->dx0); 00093 bankPars->x0 = x0tmp - k * bankPars->dx0; 00094 } else if (theta > 0 && theta < myphi) { 00095 x0tmp = bankPars->x0 - bankPars->dx1 * sin(theta); 00096 k = floor(x0tmp/bankPars->dx0); 00097 bankPars->x0 = (k+1) * bankPars->dx0 - x0tmp; 00098 } else if (-theta < myphi) { 00099 x0tmp = bankPars->x0 - bankPars->dx1 * sin(theta); 00100 k = floor(x0tmp/bankPars->dx0); 00101 bankPars->x0 = x0tmp - k * bankPars->dx0; 00102 } else { 00103 x0tmp = bankPars->x0 - bankPars->dx1 * cos(theta); 00104 k = floor(x0tmp/bankPars->dx0); 00105 bankPars->x0 = (k+1) * bankPars->dx0 - x0tmp; 00106 } 00107 DETATCHSTATUSPTR(status); 00108 RETURN(status); 00109 }
1.5.2