-
-
Save PhDP/2366354 to your computer and use it in GitHub Desktop.
A way to create a species pool from assembly process
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) | |
{ | |
// define and initialize the ecosystem list | |
//----------------------------------------- | |
sll ecosys; | |
sll_init(&ecosys,(void*)free_species); | |
// create the basal resources | |
//--------------------------- | |
basal(p,&ecosys,fert); | |
// assemble until the targetted diversity is reached | |
//-------------------------------------------------- | |
int a = divpool + EAM_NBNUT + EAM_NBDET; | |
int counter = EAM_STOP_UNSUCCESS_ASSEMBLY*divpool; | |
while(ecosys.length != a) | |
{ | |
ParamSP *sp = (void*)species(p,2); | |
install_process(p,&ecosys,sp); | |
sll_rm(&ecosys,extinct_condition); | |
++(p->num); | |
--counter; | |
if(counter == 0) | |
{ | |
sll_rm_all(&ecosys); | |
create_assembled_pool(p, pool, divpool, fert); | |
} | |
} | |
// remove the resources | |
//--------------------- | |
sll_rm(&ecosys,is_resource); | |
// create the subpool matrix and fill it with the selected species | |
//---------------------------------------------------------------- | |
sllnode *node = ecosys.head; | |
for (int i = 0; node != NULL; i++, node = node->next) | |
{ | |
ParamSP sp = *(ParamSP*)(node->data); | |
sp.d = EAM_N0SP; | |
tr_sp_array(&sp,pool[i]); | |
} | |
// free the memory | |
//---------------- | |
sll_rm_all(&ecosys); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment