ad comment for next time fix

This commit is contained in:
quentin.perret 2022-06-24 18:30:58 +02:00
parent a8c235bc65
commit 1c7d7edaae
6 changed files with 34 additions and 32 deletions

View file

@ -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++;

View file

@ -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,36 +49,25 @@ 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;
}
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 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");
}
}
}
/**
* @brief verify if all the element of an array are not NULL, return
*

View file

@ -6,7 +6,7 @@
#include <inttypes.h>
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);

View file

@ -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);
}

View file

@ -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;

View file

@ -1,2 +0,0 @@
import numpy as np