diff --git a/Code-C/average.c b/Code-C/average.c index 82c72c4..3fde2bf 100644 --- a/Code-C/average.c +++ b/Code-C/average.c @@ -11,15 +11,15 @@ */ void averageCalculation(long **p, double averageArray[]) { - printArrayData(p, nRowRawData, nCol); - printf("\n"); + // printArrayData(p, nRowRawData, nCol); + // printf("\n"); for (int i = 1; i < nCol; i++) { int j = 0; averageArray[i] = 0; while (j < nRowRawData) { - printf("pij = %ld\n", p[i][j]); + //printf("pij = %ld\n", p[i][j]); averageArray[i - 1] += (double)p[i][j]; // printf("%f , %ld\n", averageArray[i], p[i][j]); j++; diff --git a/Code-C/getArray.c b/Code-C/getArray.c index f276180..49db610 100644 --- a/Code-C/getArray.c +++ b/Code-C/getArray.c @@ -24,10 +24,24 @@ double **getDoubleArray(int N, int M) /* Allocate the array */ array[i] = (double *)malloc(M * sizeof(double)); return array; } - +/** + * @brief print all the element of a bidimensionnal array p of shape : N x M + */ +void printArrayData(long **p) +{ + for (int i = 0; i < nRowRawData; i++) + { + printf("line n°%d : ", i); + for (int j = 0; j < nCol; j++) + { + printf("%ld , ", p[i][j]); + if (j == (nCol - 1)) + printf("\n"); + } + } +} void fillArrayWithRawData(char *rawDataFileName, long **p, int N, int M) { - int i, j; char *buffer; size_t bufsize = 200; buffer = (char *)malloc(bufsize * sizeof(char)); @@ -35,35 +49,24 @@ void fillArrayWithRawData(char *rawDataFileName, long **p, int N, int M) FILE *f = fopen(rawDataFileName, "r"); - for (i = 0; i < N; i++) + for (int i = 0; i < N; i++) { long t, c1, c2, c3; while (fscanf(f, "%ld,%ld,%ld,%ld\n", &t, &c1, &c2, &c3) != EOF) { // séparation valeur par virgule initiale : csv - // printf("%ld,%ld,%ld,%ld\n", t, c1, c2, c3); + //printf("%ld,%ld,%ld,%ld\n", t, c1, c2, c3); p[i][0] = t; p[i][1] = c1; p[i][2] = c2; p[i][3] = c3; } - } - fclose(f); -} -/** - * @brief print all the element of a bidimensionnal array p of shape : N x M - */ -void printArrayData(long **p, int N, int M) -{ - for (int i = 0; i < N; i++) - { - printf("line n°%d : ", i); - for (int j = 0; j < M; j++) - { - printf("%ld , ", p[i][j]); - if (j == (M - 1)) - printf("\n"); + printf("%ld,%ld,%ld,%ld,\n",p[0][0],p[0][1],p[0][2],p[0][3]); + for(int j = 0; j < nCol; j++){ + printf("p[%d][%d] : %ld\n",i,j,p[i][j]); } } + printArrayData(p); + fclose(f); } /** * @brief verify if all the element of an array are not NULL, return diff --git a/Code-C/getArray.h b/Code-C/getArray.h index 6cd847e..556d0ee 100644 --- a/Code-C/getArray.h +++ b/Code-C/getArray.h @@ -6,7 +6,7 @@ #include long **getRawDataArray(char *rawDataFileName); -void printArrayData(long **p, int N, int M); +void printArrayData(long **p); void freeArray(long **p, int N); bool checkArrayFullyFill(long **p, int N); double **getDoubleArray(int N, int M); \ No newline at end of file diff --git a/Code-C/main.c b/Code-C/main.c index 3b90d1a..9c242a2 100644 --- a/Code-C/main.c +++ b/Code-C/main.c @@ -163,12 +163,12 @@ int main(int argc, char **argv) // exit(1); // } - pthread_t calculGrowthRate; - if (pthread_create(&calculGrowthRate, NULL, threadCalculGrowthRate, "threadCalculGrowthRate")) - { - perror("threadcalculGrowthRate() error"); - exit(1); - } + // pthread_t calculGrowthRate; + // if (pthread_create(&calculGrowthRate, NULL, threadCalculGrowthRate, "threadCalculGrowthRate")) + // { + // perror("threadcalculGrowthRate() error"); + // exit(1); + // } pthread_exit(NULL); } \ No newline at end of file diff --git a/Code-C/simulateFlux.c b/Code-C/simulateFlux.c index 14b5e2e..75fcf77 100644 --- a/Code-C/simulateFlux.c +++ b/Code-C/simulateFlux.c @@ -212,6 +212,7 @@ void *threadSimulateFlux(void *vargp) // prepare next file now fileName = createNewRawDataFileName(); rawDataFile = fopen(fileName, "w+"); + //add test to get p then print it here // p is gotten from fileName file } } rawDataWriteFlag = false; diff --git a/Py-Script/data.py b/Py-Script/data.py deleted file mode 100644 index 07ff604..0000000 --- a/Py-Script/data.py +++ /dev/null @@ -1,2 +0,0 @@ -import numpy as np -