This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef struct | |
| { | |
| unsigned int id; | |
| Params *p; | |
| } | |
| pth; | |
| void treatments(void *param, unsigned long s) | |
| { | |
| //------------// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void create_assembled_pool(Params *p, double **pool, int divpool, double fert) | |
| { | |
| restart:; | |
| // define and initialize the ecosystem list | |
| //----------------------------------------- | |
| sll ecosys; | |
| sll_init(&ecosys,(void*)free_species); | |
| // create the basal resources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| double **select_subpool(Params *p, double **pool,int nrows,int nrows_sub) | |
| { | |
| int positions[nrows]; | |
| for(int i = 0 ; i < nrows ; ++i) positions[i] = i; | |
| // shuffle the vector | |
| //------------------- | |
| knuth_shuffle((void*)positions, nrows, p->rng, sizeof(int*)); | |
| for (int i = 0 ; i < nrows ; ++i) printf("%d\t",positions[i]); | |
| printf("\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // \param p0 The structure to copy in an array. | |
| // \param param_sp An array of double with space for at least 6 elements (48 bytes). | |
| inline double *tr_sp_array(ParamSP *p, double *param_sp) | |
| { | |
| param_sp[0] = (double)p->cycle_num; | |
| param_sp[1] = (double)p->number; | |
| param_sp[2] = (double)p->ab; | |
| param_sp[3] = (double)p->pc; | |
| param_sp[4] = p->input; | |
| param_sp[5] = p->mass; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // \param p0 The structure to copy in an array. | |
| // \param param_sp An array of double with space for at least 6 elements (48 bytes). | |
| inline double *tr_sp_array(ParamSP *p, double *param_sp) | |
| { | |
| param_sp[0] = (double)p->cycle_num; | |
| param_sp[1] = (double)p->number; | |
| param_sp[2] = (double)p->ab; | |
| param_sp[3] = (double)p->pc; | |
| param_sp[4] = p->input; | |
| param_sp[5] = p->mass; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| double *tr_sp_array(ParamSP *p0) | |
| { | |
| ParamSP *p = (ParamSP*)malloc(sizeof(ParamSP)); | |
| memcpy((void*)p,(void*)p0,sizeof(ParamSP)); | |
| double *param_sp = (double*)malloc(6*sizeof(double)); | |
| param_sp[0] = (double)p->cycle_num; | |
| param_sp[1] = (double)p->number; | |
| param_sp[2] = (double)p->ab; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int rand_a_b(gsl_rng *rng, int a, int b) | |
| { | |
| return((gsl_rng_uniform(rng))%(b-a)+a); | |
| } |