Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALSimulation 6.2.0.1-8a6b96f
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
GRFlagsTest.c
Go to the documentation of this file.
1#include <lal/LALSimInspiralTestGRParams.h>
2#include <lal/LALStatusMacros.h>
3
4int main(int argc , char *argv[])
5{
6 /* Set lalDebugLevel to print all info, warnings, errors */
7
8 (void) argc;
9 (void) argv;
10 int errnum;
11
12 /* Create a new struct */
13 printf("Creating a new struct with one parameter...\n");
15 if( XLALSimInspiralAddTestGRParam(&test,"first_param",10.0) != XLAL_SUCCESS)
17 printf("value:%lf\n",XLALSimInspiralGetTestGRParam(test, "first_param"));
18
19 /* Add a second parameter to the struct */
20 printf("Adding a second parameter to the struct...\n");
21 if( XLALSimInspiralAddTestGRParam(&test,"second_param",20.0) != XLAL_SUCCESS)
23 printf("Printing the struct after adding second parameter...\n");
26 printf("Get second parameter and print its value...\n");
27 printf("value:%lf\n",XLALSimInspiralGetTestGRParam(test, "second_param"));
28
29 /* Set first parameter to new value */
30 printf("Setting first parameter to new value...\n");
31 if( XLALSimInspiralSetTestGRParam(test, "first_param",1000.0)
32 != XLAL_SUCCESS )
34 printf("new value:%lf\n",
35 XLALSimInspiralGetTestGRParam(test, "first_param"));
36
37 /* Check for existing and non-existent parameters */
38 printf("Checking for existing first parameter and non-existent third parameter...\n");
39 printf("first_param:%d second_param:%d third_param:%d\n",
40 XLALSimInspiralTestGRParamExists(test, "first_param"),
41 XLALSimInspiralTestGRParamExists(test, "second_param"),
42 XLALSimInspiralTestGRParamExists(test, "third_param"));
43 printf("Now add a third parameter...\n");
44 if( XLALSimInspiralAddTestGRParam(&test,"third_param",12.0) != XLAL_SUCCESS )
46 printf("first_param:%d second_param:%d third_param:%d\n",
47 XLALSimInspiralTestGRParamExists(test, "first_param"),
48 XLALSimInspiralTestGRParamExists(test, "second_param"),
49 XLALSimInspiralTestGRParamExists(test, "third_param"));
50
51 /* Print the params struct */
52 printf("We print the struct as it appears now...\n");
55
56 /* Try to add a parameter that already exists */
57 printf("Trying to add a parameter that already exists...\n");
58 XLAL_TRY( XLALSimInspiralAddTestGRParam(&test,"third_param",12.0), errnum );
59 printf("This throws the above message and error code %d\n", errnum);
60
61 /* Destroy the params struct */
63
64 return 0;
65}
int main(int argc, char *argv[])
Definition: GRFlagsTest.c:4
int XLALSimInspiralPrintTestGRParam(FILE *fp, LALSimInspiralTestGRParam *parameter)
Function that prints the whole test GR params linked list.
double XLALSimInspiralGetTestGRParam(const LALSimInspiralTestGRParam *parameter, const char *name)
Function that returns the value of the desired parameters in the test GR parameters linked list.
int XLALSimInspiralSetTestGRParam(LALSimInspiralTestGRParam *parameter, const char *name, const double value)
Function that sets the value of the desired parameter in the test GR parameters linked list to 'value...
int XLALSimInspiralAddTestGRParam(LALSimInspiralTestGRParam **parameter, const char *name, double value)
Function that adds a prameter to the test GR parameters linked list.
void XLALSimInspiralDestroyTestGRParam(LALSimInspiralTestGRParam *parameter)
Function that destroys the whole test GR params linked list.
bool XLALSimInspiralTestGRParamExists(const LALSimInspiralTestGRParam *parameter, const char *name)
Function that checks whether the requested parameter exists within the test GR parameters linked list...
#define XLAL_ERROR(...)
#define XLAL_TRY(statement, errnum)
XLAL_SUCCESS
XLAL_EFUNC
Linked list of any number of parameters for testing GR.