-
Izzard, Robert Dr (Maths & Physics) authoredIzzard, Robert Dr (Maths & Physics) authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
test.c 1.64 KiB
#include "binary_c.h"
#include <stdio.h>
/*
* build with:
*
* gcc test.c -Lsrc -I./src -I/usr/include -I/home/rgi/include -L/home/rgi/lib -lgsl -lgslcblas -lm -lc -lm -ldl -DUSE_GSL -lbinary_c
*
*/
int main(int argc, const char *argv[])
{
int n = 0;
int nbytes = 0;
char * buffer = NULL;
char * argstring = "binary_c M_1 1.0 M_2 3.0 metallicity 0.02 orbital_period 10.0 max_evolution_time 100.0 eccentricity 0.0";
struct libbinary_c_store_t * store = NULL;
struct libbinary_c_stardata_t * stardata = NULL;
while(n < 10)
{
binary_c_new_system(&stardata,
NULL,
NULL,
&store,
&argstring,
-1);
printf("stardata = %p sizeof %ld prefs %p\n",
stardata,
sizeof(struct stardata_t),
stardata->preferences);
fflush(NULL);
_exit(0);
stardata->preferences->internal_buffering = 2;
stardata->preferences->internal_buffering_compression = 0;
stardata->preferences->batchmode = BATCHMODE_LIBRARY;
binary_c_evolve_for_dt(stardata,stardata->model.max_evolution_time);
binary_c_buffer_info(stardata, &buffer,&nbytes);
/* Free memory */
binary_c_free_memory(&stardata, TRUE, TRUE, TRUE);
/*
* The memory which was pointed to is freed,
* but in order that the store is recreated the pointers
* must be set to NULL.
*/
store = NULL;
stardata = NULL;
Safe_free(buffer);
n++;
}
return 0;
}