Agents in Biology
195
if(temp<=source_production)
{
if(LIFE>DIE)
{
// produce 8 proteins at a time
for(i=0;i<8;i++)
{
NUMBERPROTEINS++;
add_Protein_agent(NUMBERPROTEINS,1000.0,0,0,1,X,Y);
}
}
}
}
return 0;
}
int Source_filewrite()
{
FILE *file;
char data[1000];
char * location="proteindist";
int protein_dist[100];
int i;
int pd=0;
for(i=0;i<100;i++)
{
protein_dist[i]=0;
}
//produce a particular text file
sprintf(data, "%s.txt",location);
if((file = fopen(data, "a"))==NULL)
{
printf("Error: cannot open file ’%s’ for writing\n", data);
exit(0);
}
proteinnumber_compartment_message=
get_first_proteinnumber_compartment_message();
while(proteinnumber_compartment_message)
{
pd=proteinnumber_compartment_message->compartment_id-1;
protein_dist[pd]=proteinnumber_compartment_message->production;
proteinnumber_compartment_message=
get_next_proteinnumber_compartment_message
(proteinnumber_compartment_message);
}
sprintf(data, "%d", TIMECOUNTER);
fputs(data, file);
for(i=0;i<100;i++)
{
fputs(" ", file);
sprintf(data, "%d", protein_dist[i]);
fputs(data, file);
}
Précédent

- 224/329

Suivant