Commit a6404f4a authored by Cassio Kirch's avatar Cassio Kirch
Browse files

Average Neighbors File added and SigleFile is now named GodFile.

parent efbe2a8e
...@@ -62,7 +62,7 @@ putParametersToFile(FILE* file) ...@@ -62,7 +62,7 @@ putParametersToFile(FILE* file)
} }
FILE* FILE*
initializeSingleFile () initializeGodFile ()
{ {
FILE* dat; FILE* dat;
char fileName[FILENAME_SIZE]; char fileName[FILENAME_SIZE];
...@@ -83,6 +83,19 @@ initializeGammaFile() ...@@ -83,6 +83,19 @@ initializeGammaFile()
return gammaFile; 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* FILE*
initializeStepAndTypeFile (const unsigned long long int step, \ initializeStepAndTypeFile (const unsigned long long int step, \
const cellType type) const cellType type)
......
#include "boid.h" #include "boid.h"
FILE* initializeSingleFile (); FILE* initializeGodFile ();
FILE* initializeStepAndTypeFile (const unsigned long long int step, \ FILE* initializeStepAndTypeFile (const unsigned long long int step, \
const cellType type); const cellType type);
#if defined (ENDO_GAMMA) || defined (ECTO_GAMMA)
FILE* initializeGammaFile(); FILE* initializeGammaFile();
#endif
#ifdef COUNT_NEIGHBORS
FILE* initializeAverageNeighborsFile ();
#endif
FILE* initializeFinalConfigurationFile(); FILE* initializeFinalConfigurationFile();
void setDate (); void setDate ();
......
...@@ -68,26 +68,6 @@ getGamma (const struct Boid* const boids) ...@@ -68,26 +68,6 @@ getGamma (const struct Boid* const boids)
#endif #endif
#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; return gamma;
} }
#endif /* #if defined(ENDO_GAMMA) || defined(ECTO_GAMMA) */ #endif /* #if defined(ENDO_GAMMA) || defined(ECTO_GAMMA) */
...@@ -100,7 +80,7 @@ one_system () ...@@ -100,7 +80,7 @@ one_system ()
unsigned int boidCount, boxID, threadCount; unsigned int boidCount, boxID, threadCount;
unsigned long long int step, continuousStep = 0; unsigned long long int step, continuousStep = 0;
FILE* godFile = initializeSingleFile(); FILE* godFile = initializeGodFile();
FILE* finalConfigurationFile; FILE* finalConfigurationFile;
#ifdef PLOT_EXIT_FILES #ifdef PLOT_EXIT_FILES
...@@ -111,6 +91,10 @@ one_system () ...@@ -111,6 +91,10 @@ one_system ()
#ifdef GAMMA_FILE #ifdef GAMMA_FILE
FILE* gammaFile = initializeGammaFile(); FILE* gammaFile = initializeGammaFile();
#endif #endif
#ifdef COUNT_NEIGHBORS
FILE* averageNeighborsFile = initializeAverageNeighborsFile();
#endif
/* Set the pthread_create parameters. */ /* Set the pthread_create parameters. */
struct Parameters parametersStruct[NUM_THREADS]; struct Parameters parametersStruct[NUM_THREADS];
...@@ -158,7 +142,7 @@ one_system () ...@@ -158,7 +142,7 @@ one_system ()
printf("Step: %llu\n", step); printf("Step: %llu\n", step);
#ifdef COUNT_NEIGHBORS #ifdef COUNT_NEIGHBORS
printf("Average neighbors: %lf\n", getAverageNeighborsNo(boid)); fprintf(averageNeighborsFile, "%llu\t%lf\n", step, getAverageNeighborsNo(boid));
#endif #endif
#ifdef PLOT_EXIT_FILES #ifdef PLOT_EXIT_FILES
...@@ -197,9 +181,13 @@ one_system () ...@@ -197,9 +181,13 @@ one_system ()
#ifdef GAMMA_FILE #ifdef GAMMA_FILE
fclose (gammaFile); fclose (gammaFile);
#endif #endif
fclose (godFile);
#ifdef COUNT_NEIGHBORS
fclose(averageNeighborsFile);
#endif
fclose (godFile);
finalConfigurationFile = initializeFinalConfigurationFile(); finalConfigurationFile = initializeFinalConfigurationFile();
for (boidCount=0; boidCount<N; boidCount++) 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