Commit a6404f4a authored by Cassio Kirch's avatar Cassio Kirch

Average Neighbors File added and SigleFile is now named GodFile.

parent efbe2a8e
......@@ -62,7 +62,7 @@ putParametersToFile(FILE* file)
}
FILE*
initializeSingleFile ()
initializeGodFile ()
{
FILE* dat;
char fileName[FILENAME_SIZE];
......@@ -83,6 +83,19 @@ initializeGammaFile()
return gammaFile;
}
#ifdef COUNT_NEIGHBORS
FILE*
initializeAverageNeighborsFile ()
{
FILE* myFile;
char fileName[FILENAME_SIZE];
sprintf(fileName, "avgNeighbors_%s.dat", dateString);
myFile = fopen(fileName, "w");
putParametersToFile(myFile);
return myFile;
}
#endif
FILE*
initializeStepAndTypeFile (const unsigned long long int step, \
const cellType type)
......
#include "boid.h"
FILE* initializeSingleFile ();
FILE* initializeGodFile ();
FILE* initializeStepAndTypeFile (const unsigned long long int step, \
const cellType type);
#if defined (ENDO_GAMMA) || defined (ECTO_GAMMA)
FILE* initializeGammaFile();
#endif
#ifdef COUNT_NEIGHBORS
FILE* initializeAverageNeighborsFile ();
#endif
FILE* initializeFinalConfigurationFile();
void setDate ();
......
......@@ -68,26 +68,6 @@ getGamma (const struct Boid* const boids)
#endif
#endif
/*
double gamma = 0.0;
unsigned int endoBoids = (unsigned)(ENDOPROP*N);
unsigned int boidCount = endoBoids;
do
{
boidCount--;
if (boids[boidCount].gamma <= 1.01)
gamma += boids[boidCount].gamma/endoBoids;
}
while(boidCount != 0);
*/
#ifdef DEBUG
for (boidCount = (unsigned)(ENDOPROP*N); boidCount < N; ++boidCount)
if (boids[boidCount].type == ENDODERM)
printf("Endo cell treated as a ecto one. %u\n", boidCount);
#endif
return gamma;
}
#endif /* #if defined(ENDO_GAMMA) || defined(ECTO_GAMMA) */
......@@ -100,7 +80,7 @@ one_system ()
unsigned int boidCount, boxID, threadCount;
unsigned long long int step, continuousStep = 0;
FILE* godFile = initializeSingleFile();
FILE* godFile = initializeGodFile();
FILE* finalConfigurationFile;
#ifdef PLOT_EXIT_FILES
......@@ -111,6 +91,10 @@ one_system ()
#ifdef GAMMA_FILE
FILE* gammaFile = initializeGammaFile();
#endif
#ifdef COUNT_NEIGHBORS
FILE* averageNeighborsFile = initializeAverageNeighborsFile();
#endif
/* Set the pthread_create parameters. */
struct Parameters parametersStruct[NUM_THREADS];
......@@ -158,7 +142,7 @@ one_system ()
printf("Step: %llu\n", step);
#ifdef COUNT_NEIGHBORS
printf("Average neighbors: %lf\n", getAverageNeighborsNo(boid));
fprintf(averageNeighborsFile, "%llu\t%lf\n", step, getAverageNeighborsNo(boid));
#endif
#ifdef PLOT_EXIT_FILES
......@@ -197,9 +181,13 @@ one_system ()
#ifdef GAMMA_FILE
fclose (gammaFile);
#endif
fclose (godFile);
#ifdef COUNT_NEIGHBORS
fclose(averageNeighborsFile);
#endif
fclose (godFile);
finalConfigurationFile = initializeFinalConfigurationFile();
for (boidCount=0; boidCount<N; boidCount++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment