43#include <lal/LALInspiralBank.h>
44#include <lal/AVFactories.h>
45#include <lal/SeqFactories.h>
46#include <lal/LALStdio.h>
47#include <lal/FindRoot.h>
50#define UNUSED __attribute__ ((unused))
107 tempPars->
eta = 0.25;
108 tempPars->
ieta = 1.L;
152 cells[0].
t0 = tempPars->
t0;
153 cells[0].
t3 = tempPars->
t3;
157 A0 = 5. / pow(piFl, 8./3.) / 256.;
158 A3 =
LAL_PI / pow(piFl, 5./3.)/8.;
166 &gridParam, &cellEvolution,
172 INT4 *new_list = NULL;
198 for ( k = 0; k < length; k++)
200 new_list[k] = ptr->
id;
204 for (kk = 0; kk < length; kk++)
210 k, tempPars, &gridParam, &cellEvolution, &cellList);
222 if (cellList != NULL)
234 for ( k = 0; k < length; k++)
245 tempA3 = pow(A3, -5./2.)/pow(0.25,-1.5);
246 tempPars->
t0 = cells[k].
t0;
247 tempPars->
t3 = cells[k].
t3;
250 if(cells[k].RectPosition[0] ==
Below )
258 a = tan(cells[k].metric.theta);
259 b = cells[k].
t3 -
a * cells[k].
t0;
266 prin.
ct =
a * A0 * tempA3;
270 &x0, &input, (
void *)&prin);
273 tempPars->
t3 = x0 + 1
e-3;
274 tempPars->
t0 = (tempPars->
t3 - b)/
a;
275 if (tempPars->
t0 > 0)
280 cells[k].
t0 = tempPars->
t0;
281 cells[k].
t3 = tempPars->
t3;
292 switch (cells[k].RectPosition[1]){
293 case Above: above +=1;
break;
299 switch (cells[k].RectPosition[2]){
300 case Above: above +=1;
break;
306 switch (cells[k].RectPosition[3]){
307 case Above: above +=1;
break;
313 switch (cells[k].RectPosition[4]){
314 case Above: above +=1;
break;
322 if (above == 2 && cells[k].position ==
In)
331 if (cells[
i].position ==
In ) {
351 if (cells[
i].position ==
In)
353 tempPars->
t0 = cells[
i].
t0;
354 tempPars->
t3 = cells[
i].
t3;
361 (*list)[*nlist].ID = *nlist;
362 (*list)[*nlist].params = *tempPars;
363 (*list)[*nlist].metric = cells[
i].
metric;
405 dx0 = (*cell)[headId].dx0;
406 dx1 = (*cell)[headId].dx1;
407 theta = (*cell)[headId].metric.theta;
418 for (
i = 0;
i < 6;
i++)
420 if ((*cell)[headId].child[
i] == -1)
441 (*cell)[offSpring + it].t0 = (*cell)[headId].t0;
442 (*cell)[offSpring + it].t3 = (*cell)[headId].t3;
443 (*cell)[offSpring + it].t0 += newt0 *ctheta + stheta* newt3;
444 (*cell)[offSpring + it].t3 += newt0 *stheta - ctheta* newt3;
446 moments, paramsIn, gridParam, cellEvolution, cellList);
450 newt3 = -dx1 *sqrt(3./2) ;
451 (*cell)[offSpring + it].t0 = (*cell)[headId].t0;
452 (*cell)[offSpring + it].t3 = (*cell)[headId].t3;
453 (*cell)[offSpring + it].t0 += newt0 * ctheta + stheta * newt3;
454 (*cell)[offSpring + it].t3 += newt0 * stheta - ctheta * newt3;
456 moments, paramsIn, gridParam, cellEvolution, cellList);
460 newt3 = -dx1 *sqrt(3./2);
461 (*cell)[offSpring + it].t0 = (*cell)[headId].t0;
462 (*cell)[offSpring + it].t3 = (*cell)[headId].t3;
463 (*cell)[offSpring + it].t0 += newt0 * ctheta + stheta * newt3;
464 (*cell)[offSpring + it].t3 += newt0 * stheta - ctheta * newt3;
466 moments, paramsIn, gridParam, cellEvolution, cellList);
471 (*cell)[offSpring + it].t0 = (*cell)[headId].t0;
472 (*cell)[offSpring + it].t3 = (*cell)[headId].t3;
473 (*cell)[offSpring + it].t0 += newt0 * ctheta + stheta * newt3;
474 (*cell)[offSpring + it].t3 += newt0 * stheta - ctheta * newt3;
476 moments, paramsIn, gridParam, cellEvolution, cellList);
480 newt3 = dx1 *sqrt(3./2);
481 (*cell)[offSpring + it].t0 = (*cell)[headId].t0;
482 (*cell)[offSpring + it].t3 = (*cell)[headId].t3;
483 (*cell)[offSpring + it].t0 += newt0 * ctheta + stheta * newt3;
484 (*cell)[offSpring + it].t3 += newt0 * stheta - ctheta * newt3;
486 moments, paramsIn, gridParam, cellEvolution, cellList);
490 newt3 = dx1 *sqrt(3./2);
491 (*cell)[offSpring + it].t0 = (*cell)[headId].t0;
492 (*cell)[offSpring + it].t3 = (*cell)[headId].t3;
493 (*cell)[offSpring + it].t0 += newt0 * ctheta + stheta * newt3;
494 (*cell)[offSpring + it].t3 += newt0 * stheta - ctheta * newt3;
496 moments, paramsIn, gridParam, cellEvolution, cellList);
502 if ((*cell)[offSpring + it].child[(
i+3)%6] == -1)
504 (*cell)[offSpring + it].child[(
i+3)%6] = (*cell)[headId].ID;
505 (*cell)[headId].child[
i] = offSpring+it;
516 (*cell)[headId].status =
Sterile;
523 if ((*cell)[headId].RectPosition[0] ==
Above && (*cell)[headId].in == 1)
525 (*cell)[headId].RectPosition[0]=
Out;
533 id1 = (*cell)[headId].child[
i%6];
534 id2 = (*cell)[headId].child[(
i+1)%6];
535 (*cell)[id1].child[(
i+2)%6] = (*cell)[id2].ID;
536 (*cell)[id2].child[(
i+4+1)%6] = (*cell)[id1].ID;
542 id1 = (*cell)[headId].child[
i%6];
544 if ((*cell)[id1].status ==
Fertile)
547 moments, cellEvolution, cellList);
550 if ((*cell)[id1].position !=
In )
593 for (
i = 0;
i < 6;
i++)
595 (*cell)[
id].child[
i] = -1;
600 (*cell)[
id].position =
In;
601 (*cell)[
id].metric.space = gridParam->
space;
605 if ((*cell)[
id].
t0 > 0 && (*cell)[
id].t3 > 0)
608 paramsIn->
t0 = (*cell)[
id].t0;
609 paramsIn->
t3 = (*cell)[
id].t3;
612 &((*cell)[
id].metric),
618 (*cell)[
id].dx0 = sqrt(2.L * (1.L - gridParam->
mm)/(*cell)[
id].metric.g00 );
619 (*cell)[
id].dx1 = sqrt(2.L * (1.L - gridParam->
mm)/(*cell)[
id].metric.g11 );
622 &((*cell)[
id].RectPosition[0]), paramsIn, gridParam);
626 if ((*cell)[
id].RectPosition[0] ==
Out)
628 (*cell)[
id].position =
Out;
629 for (
i = 0;
i < 5;
i++)
631 (*cell)[
id].RectPosition[
i] =
Out;
644 gridParam, cellEvolution, &(*cellList), &valid);
657 (*cell)[
id].RectPosition[
i] =
Out;
659 (*cell)[
id].position =
Out;
671 INT4 below=0, above=0;
672 for (
i=1;
i<=4;
i++){
673 if ( (*cell)[
id].RectPosition[
i] ==
Below) below++;
674 if ( (*cell)[
id].RectPosition[
i] ==
Above) above++;
676 if (below==2 && above == 2){
677 (*cell)[
id].position =
Edge;
718 RectIn.
dx = (*cell)[
id].dx0 ;
719 RectIn.
dy = (*cell)[
id].dx1 ;
720 RectIn.
theta = (*cell)[
id].metric.theta;
728 paramsIn.
t0 = RectOut.
x1;
729 paramsIn.
t3 = RectOut.
y1;
731 if (RectOut.
x1<0 || RectOut.
y1<0
732 || RectOut.
x2<0 || RectOut.
y2<0
733 || RectOut.
x3<0 || RectOut.
y3<0
734 || RectOut.
x4<0 || RectOut.
y4<0)
741 if (RectOut.
x1>0 && RectOut.
y1>0)
744 &((*cell)[
id].RectPosition[1]),
750 paramsIn.
t0 = RectOut.
x2;
751 paramsIn.
t3 = RectOut.
y2;
752 if (RectOut.
x2>0 && RectOut.
y2>0){
754 &((*cell)[
id].RectPosition[2]), ¶msIn, gridParam);
759 paramsIn.
t0 = RectOut.
x3;
760 paramsIn.
t3 = RectOut.
y3;
761 if (RectOut.
x3>0 && RectOut.
y3>0)
764 &((*cell)[
id].RectPosition[3]), ¶msIn, gridParam);
768 paramsIn.
t0 = RectOut.
x4;
769 paramsIn.
t3 = RectOut.
y4;
770 if (RectOut.
x4>0 && RectOut.
y4>0)
773 &((*cell)[
id].RectPosition[4]), ¶msIn, gridParam);
797 INT4 below = 0, in = 0, out = 0, above = 0;
803 switch ((*cell)[id1].RectPosition[1]){
804 case In: in +=1;
break;
805 case Below: below +=1;
break;
806 case Above: above +=1;
break;
807 case Out: out +=1;
break;
810 switch ((*cell)[id1].RectPosition[2]){
811 case In: in +=1;
break;
812 case Below: below +=1;
break;
813 case Above: above +=1;
break;
814 case Out: out +=1;
break;
817 switch ((*cell)[id1].RectPosition[3]){
818 case In: in +=1;
break;
819 case Below: below +=1;
break;
820 case Above: above +=1;
break;
821 case Out: out +=1;
break;
824 switch ((*cell)[id1].RectPosition[4]){
825 case In: in +=1;
break;
826 case Below: below +=1;
break;
827 case Above: above +=1;
break;
828 case Out: out +=1;
break;
831 switch ((*cell)[id1].RectPosition[0]){
832 case In: in +=1;
break;
833 case Below: below +=1;
break;
834 case Above: above +=1;
break;
835 case Out: out +=1;
break;
839 (*cell)[id1].in = in;
841 if ((*cell)[id1].RectPosition[0]==
In)
843 (*cell)[id1].position =
In;
855 (*cell)[id1].position =
Out;
864 else if ( below == 5){
865 (*cell)[id1].position =
Out;
866 if ((*cell)[id1].status ==
Fertile)
875 (*cell)[id1].position =
Out;
876 if ((*cell)[id1].status ==
Fertile)
885 (*cell)[id1].position =
In;
886 if ((*cell)[id1].status ==
Sterile)
894 else if (above+below >= 5){
896 (*cell)[id1].position =
Out;
897 if ((*cell)[id1].status ==
Fertile)
907 (*cell)[id1].position =
In;
908 if ((*cell)[id1].status ==
Sterile)
919 (*cell)[id1].position =
Out;
920 if ((*cell)[id1].status ==
Fertile)
945 REAL4 totalMass, oneby4,
tiny, piFl, A0, A3;
953 A0 = 5. / pow(piFl, 8./3.) / 256.;
954 A3 =
LAL_PI / pow(piFl, 5./3.)/8.;
961 totalMass = A0 * paramsIn->
t3/(A3 * paramsIn->
t0);
962 eta = A0/(paramsIn->
t0 * pow(totalMass, (5./3.)));
973 paramsIn->
mass1 = 0.5*totalMass * ( 1.L + sqrt(1.L - 4.L*eta));
974 paramsIn->
mass2 = 0.5*totalMass * ( 1.L - sqrt(1.L - 4.L*eta));
978 if ((paramsIn->
t3-dx1)<0)
984 mint3 = paramsIn->
t3-dx1;
987 if ( (paramsIn->
t0 <gridParam->
x0Min - dx0)
988 ||(paramsIn->
t0 >gridParam->
x0Max + dx0)
989 || (paramsIn->
t3 <= mint3))
1004 paramsIn->
eta <= 0.25 &&
1011 if (paramsIn->
eta > .25){
1024 paramsIn->
eta <= 0.25 &&
1031 if (paramsIn->
eta > .25){
1045 paramsIn->
eta <= 0.25 &&
1051 else if (paramsIn->
eta > .25 ){
1061 REAL4 totalMass2 = A0 * (paramsIn->
t3 - dx1)/(A3 * paramsIn->
t0);
1063 totalMass = A0 * paramsIn->
t3/(A3 * (paramsIn->
t0 - dx0));
1066 if ( totalMass < gridParam->MMin && totalMass2 < gridParam->MMin )
1074 ABORT(
status, 999,
"Invalid choice for enum InspiralBankMassRange");
1096 prin = (
PRIN *)param;
1100 *result = ct*pow(t3,5./2.) - t3 + b;
void LALInspiralParameterCalc(LALStatus *status, InspiralTemplate *params)
void LALSPAValidPosition(LALStatus *status, InspiralCell **cell, INT4 id1, InspiralMomentsEtc UNUSED *moments, CellEvolution *cellEvolution, CellList **cellList)
void GetPositionRectangle(LALStatus *status, InspiralCell **cell, INT4 id, InspiralTemplate *params, HexaGridParam *gridParam, CellEvolution UNUSED *cellEvolution, CellList UNUSED **cellList, INT4 *valid)
#define ABORT(statusptr, code, mesg)
#define CHECKSTATUSPTR(statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
void LALSBisectionFindRoot(LALStatus *status, REAL4 *root, SFindRootIn *input, void *params)
#define LALINSPIRALH_ESIZE
Invalid input range.
@ t03
chirptimes and , and
@ m1Andm2
component masses
void LALInitHexagonalBank(LALStatus *status, InspiralCell **cell, INT4 id, InspiralMomentsEtc *moments, InspiralTemplate *paramsIn, HexaGridParam *gridParam, CellEvolution *cellEvolution, CellList **cellList)
UINT4 LALListLength(CellList *head)
#define LALINSPIRALBANKH_EHEXAINIT
Empty bank.
void LALRectangleVertices(LALStatus *status, RectangleOut *out, RectangleIn *in)
Function to find the vertices of a rectangle given its centre, half side-lengths and orientation angl...
void LALInspiralSetParams(LALStatus *status, InspiralTemplate *tempPars, InspiralCoarseBankIn coarseIn)
A routine that fills an InspiralTemplate structure based on the values in the InspiralCoarseBankIn st...
void LALInspiralSetSearchLimits(LALStatus *status, InspiralBankParams *bankParams, InspiralCoarseBankIn coarseIn)
Function which calculates the minimum and maximum values of and .
void LALInspiralCreatePNCoarseBankHexa(LALStatus *status, InspiralTemplateList **list, INT4 *nlist, InspiralCoarseBankIn coarseIn)
void LALListAppend(CellList **headRef, INT4 id)
Position
This enum can take the following values In, Out, Below, Edge, Above and is used only by the Hexagonal...
void LALPopulateCell(LALStatus *status, InspiralMomentsEtc *moments, InspiralCell **cell, INT4 headId, InspiralTemplate *paramsIn, HexaGridParam *gridParam, CellEvolution *cellEvolution, CellList **cellList)
void LALFindPosition(LALStatus *status, REAL4 dx0, REAL4 dx1, Position *position, InspiralTemplate *paramsIn, HexaGridParam *gridParam)
void LALGetInspiralMoments(LALStatus *status, InspiralMomentsEtc *moments, REAL8FrequencySeries *psd, InspiralTemplate *params)
void LALListDelete(CellList **headRef, INT4 id)
void LALSPAF(LALStatus *status, REAL4 *result, REAL4 t3, void *param)
#define LALINSPIRALBANKH_ESIZE
Invalid input range.
#define LALINSPIRALBANKH_EMEM
Memory allocation failure.
void LALInspiralComputeMetric(LALStatus *status, InspiralMetric *metric, InspiralTemplate *params, InspiralMomentsEtc *moments)
@ MinMaxComponentTotalMass
@ MinComponentMassMaxTotalMass
@ HybridHexagonal
UNDOCUMENTED.
This is a structure needed in the inner workings of the LALInspiralHexagonalBank code.
This is a structure needed in the inner workings of the LALInspiralHexagonalBank code.
struct tagCellList * next
This is a structure needed in the inner workings of the LALInspiralHexagonalBank code.
InspiralBankMassRange massRange
This is a structure needed in the inner workings of the LALInspiralCreateCoarseBank code.
REAL8 x1Max
maximum value of the second coordinate as defined by the search region
REAL8 x1Min
minimum value of the second coordinate as defined by the search region
REAL8 x0Min
minimum value of the first coordinate as defined by the search region
REAL8 x0Max
maximum value of the first coordinate as defined by the search region
This is a structure needed in the inner workings of the LALInspiralHexagonalBank code.
Input for choosing a template bank.
REAL8 mMin
minimum mass of components to search for
REAL8 mMax
maximum mass of components to search for
InspiralBankMassRange massRange
enum that determines whether templates should be chosen using fixed ranges for component masses or to...
GridSpacing gridSpacing
Type of gridspacing required.
REAL8FrequencySeries shf
Frequency series containing the PSD.
REAL8 MMax
alternatively, maximum total mass of binary to search for
REAL8 etamin
minimum value of eta in our search
REAL8 fLower
Lower frequency cutoff.
REAL8 mmCoarse
Coarse grid minimal match.
CoordinateSpace space
enum that decides whether to use or in constructing the template bank
Parameter structure that holds the moments of the PSD and other useful constants required in the comp...
The inspiral waveform parameter structure containing information about the waveform to be generated.
INT4 ieta
parameter that tells whether the symmetric mass ratio should be set to zero in the PN expansions of ...
REAL8 eta
symmetric mass ratio (input/output)
REAL8 totalMass
total mass of the binary in solar mass (input/output)
REAL8 mass1
Mass of the primary in solar mass (input/output)
REAL8 t3
1.5 post-Newtonian chirp time in seconds (input/output)
REAL8 t0
Newtonain chirp time in seconds (input/output)
REAL8 mass2
Mass of the secondary in solar mass (mass1 need not be larger than mass2 (input/output)
InputMasses massChoice
The pair of (mass) parameters given (see structure defining this member for more details) (input)
REAL8 fLower
lower frequency cutoff of the detector in Hz (input)
A grid of inspiral templates (ie a template list).
Input structure to function LALRectangleVertices()
Output structure to function LALRectangleVertices().
void(* function)(LALStatus *s, REAL4 *y, REAL4 x, void *p)