From 8ecdd376191c82b09472dc15cf72c549b223ea9c Mon Sep 17 00:00:00 2001 From: "quentin.perret" Date: Thu, 16 Jun 2022 17:05:12 +0200 Subject: [PATCH] growth ok --- Code-C/average.c | 22 ++++++++++++++-------- Code-C/average.h | 2 +- Code-C/getArray.c | 4 ++-- Code-C/growthRate.c | 15 +++++++++++++-- Code-C/growthRate.h | 2 +- Code-C/initialParameters.h | 3 ++- Code-C/main | Bin 41760 -> 42008 bytes Code-C/main.c | 30 +++++++++++++++++++----------- Code-C/power.c | 12 +++++------- Code-C/simulateFlux.c | 2 +- 10 files changed, 58 insertions(+), 34 deletions(-) diff --git a/Code-C/average.c b/Code-C/average.c index e9d8706..8fef657 100644 --- a/Code-C/average.c +++ b/Code-C/average.c @@ -13,12 +13,11 @@ void averageCalculation(long **p, double averageArray[]){ for(int i = 1; i < nCol; i++){ int j = 0; averageArray[i] = 0; - while(j < nRow -1){ + while(j < nRowRawData){ averageArray[i] += p[i][j]; j++; } - averageArray[i] /= nRow; - //printf("%f\n", powerArray[i]); + averageArray[i] /= nRowRawData; } } @@ -27,12 +26,19 @@ void averageCalculation(long **p, double averageArray[]){ * * @param rawDataFileName name of the raw data file to use to realize the calcul */ -void averageThreadFunction(char* rawDataFileName){ +void averageFunction(char* rawDataFileName , double **aver){ long **p = getRawDataArray(rawDataFileName); - double aver[nCol -1]; + double averN[nCol -1]; if(p !=NULL){ - averageCalculation(p,aver); - appendDataInFile("averageData.csv",aver,nCol-1); - freeArray(p,nRow); + if(p !=NULL){ + if(aver == NULL){ + averageCalculation(p,averN); + appendDataInFile("averageData.csv",averN,nCol-1); + }else{ + averageCalculation(p,aver[1]); + appendDataInFile("averageData.csv",aver[1],nCol-1); + } + freeArray(p,nRowRawData); + } } } \ No newline at end of file diff --git a/Code-C/average.h b/Code-C/average.h index b130865..a121de4 100644 --- a/Code-C/average.h +++ b/Code-C/average.h @@ -1,4 +1,4 @@ #include #include -void averageThreadFunction(char* rawDataFileName); \ No newline at end of file +void averageFunction(char* rawDataFileName , double **aver); \ No newline at end of file diff --git a/Code-C/getArray.c b/Code-C/getArray.c index 7284378..f8c05ef 100644 --- a/Code-C/getArray.c +++ b/Code-C/getArray.c @@ -97,8 +97,8 @@ void freeArray(long **p, int N) { */ long **getRawDataArray(char* rawDataFileName){ long **p; - p = getlongArray(nRow, nCol); - fillArrayWithRawData(rawDataFileName,p ,nRow, nCol); + p = getlongArray(nRowRawData, nCol); + fillArrayWithRawData(rawDataFileName,p ,nRowRawData, nCol); //if(checkArrayFullyFill(p,nRow)){ //clearRawData(N); return p; diff --git a/Code-C/growthRate.c b/Code-C/growthRate.c index 8fcca10..64a0a2e 100644 --- a/Code-C/growthRate.c +++ b/Code-C/growthRate.c @@ -18,8 +18,19 @@ void growthRateCalculation(double **dataArray , double *gRateArray){ * * @param dataLign */ -void growthRateFunction(double **dataLign){ +void growthRateFunction(double **dataLign , char* fileName){ double gRateArray[nCol-1]; growthRateCalculation(dataLign , gRateArray); - appendDataInFile("growthRate.csv",gRateArray , nCol-1); + appendDataInFile(fileName,gRateArray , nCol-1); +} + +void sumColArray(long **p, double res[] , int N , int M){ + for(int i = 1; i < M; i++){ + int j = 0; + res[i] = 0; + while(j < N){ + res[i] += p[i][j]; + j++; + } + } } \ No newline at end of file diff --git a/Code-C/growthRate.h b/Code-C/growthRate.h index 7979f21..d68b096 100644 --- a/Code-C/growthRate.h +++ b/Code-C/growthRate.h @@ -1,4 +1,4 @@ #include #include -void growthRateFunction(double **dataLign); \ No newline at end of file +void growthRateFunction(double **dataLign , char* fileName); \ No newline at end of file diff --git a/Code-C/initialParameters.h b/Code-C/initialParameters.h index 96201f5..5403af0 100644 --- a/Code-C/initialParameters.h +++ b/Code-C/initialParameters.h @@ -2,7 +2,8 @@ #include "queue.h" extern bool rawDataWriteFlag; -extern int nRow; +extern int nRowRawData; +extern int nRowGR; extern int nCol; extern double freqEch; diff --git a/Code-C/main b/Code-C/main index 3cd197e6963024a135e688b05bc98a32ecf109a8..d9efec68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H>i03=VDP(#d$saQ0mkfDqHO01YJRHfs=bhzFN?mm+7mXnqFbaJhVwU*SkjGbI z_}<;)n3=;%!d{=>(DwYunv4Q?*kONoUoBe=d1o&fcZm`HF+<+-2bY%&dCwmw z-ZbQ2W=Vi;2F@WNm!tT~u<7{;@q@_ICdSfRlQYs;X#f}`pKsXe^^Jg*YWQeBDXuoO ze*QAFlMU@jV@8%6+SvkmxuNa(_4qsPY4ZB$F7BbT(0GX&uF4adfrCfHqab~R}Aev!@lQhnm*eI=cj&hxHlW4{wIyA zfV7LygdM}ZTd=tHTM3`CEHANx6Op5c0(aP=wGh9_9@OyYA}ysSF1y5$>F zWZ^@nS>%pwH>>8QlkZv?`QsyBvB>tvs!i&--u$O0itMo?4R4~sPu_?FeD#yXw%Ge< z6@U53GP_c00GCG2Ke>tFKRTqUr$DL(%ulPw?QI1&oh+RW%(e+Z<&R6d$vpv@=xn=x~U1fIPBa$1-c-vzc F{|CvpNt*xw diff --git a/Code-C/main.c b/Code-C/main.c index 32e7fd7..f48a16a 100644 --- a/Code-C/main.c +++ b/Code-C/main.c @@ -9,7 +9,8 @@ #include "getArray.h" bool rawDataWriteFlag; -int nRow = 500; +int nRowRawData = 500; +int nRowGR = 150; int nCol = 1; double freqEch = 250; @@ -43,7 +44,7 @@ void *threadCalculAverage(void *vargp){ while(queueGetNextE(rawDataQueue) != NULL){ rawDataQueue = queueGetNextE(rawDataQueue); fileName = queueGetTabChar(rawDataQueue); - averageThreadFunction(fileName); + averageFunction(fileName, NULL); remove(fileName); } } @@ -57,7 +58,7 @@ void *threadCalculBoth(void *vargp){ rawDataQueue = queueGetNextE(rawDataQueue); fileName = queueGetTabChar(rawDataQueue); powerFunction(fileName, NULL); - averageThreadFunction(fileName); + averageFunction(fileName , NULL); remove(fileName); } } @@ -67,7 +68,8 @@ void *threadCalculGrowthRate(void * vargp){ Pqueue rawDataQueue = firstRawDataQueue; char* fileName; //double pw[nCol-1]; - double **dataLign = getDoubleArray(2,nCol); + double **dataLignPw = getDoubleArray(2,nCol); + double **dataLignAv = getDoubleArray(2,nCol); int i = 0; while(rawDataWriteFlag){ @@ -76,18 +78,24 @@ void *threadCalculGrowthRate(void * vargp){ fileName = queueGetTabChar(rawDataQueue); if(i < 2){ if(i == 1){ - powerFunction(fileName, dataLign); - growthRateFunction(dataLign); + powerFunction(fileName, dataLignPw); + averageFunction(fileName , dataLignAv); + growthRateFunction(dataLignPw , "growthRatePw.csv"); + growthRateFunction(dataLignPw,"growthRateAv.csv"); }else{ - powerFunction(fileName, dataLign); + averageFunction(fileName , dataLignAv); + powerFunction(fileName, dataLignPw); } i++; }else{ for(int y = 0; y < (nCol-1); y++){ - dataLign[0][y] = dataLign[1][y]; + dataLignPw[0][y] = dataLignPw[1][y]; + dataLignAv[0][y] = dataLignAv[1][y]; } - powerFunction(fileName, dataLign); - growthRateFunction(dataLign); + powerFunction(fileName, dataLignPw); + averageFunction(fileName , dataLignAv); + growthRateFunction(dataLignPw,"growthRatePw.csv"); + growthRateFunction(dataLignPw,"growthRateAv.csv"); } //remove(fileName); } @@ -105,7 +113,7 @@ int main(int argc , char** argv){ rawDataWriteFlag = true; period = 1 / freqEch; - invTimeBandWidth = 1 /(nRow * period); + invTimeBandWidth = 1 /(nRowRawData * period); firstRawDataQueue = queueCreateEmpty(); // change this for create empty pthread_t rawData; diff --git a/Code-C/power.c b/Code-C/power.c index 6fd69d1..ea62528 100644 --- a/Code-C/power.c +++ b/Code-C/power.c @@ -11,17 +11,15 @@ * @param powerArray array where results are stocked */ void powerCalculation(long **p, double powerArray[]){ - printf("data in pw : \n"); for(int i = 0; i < nCol; i++){ int j = 0; powerArray[i] = 0; - while(j < nRow){ - printf("\np[%d,%d] = %d\npwArray[%d] = %lf\n" , j,i,p[j][i+1],i,powerArray[i]); + while(j < nRowRawData){ powerArray[i] += pow(p[j][i+1],2); j++; } - powerArray[i] /= nRow; + powerArray[i] /= nRowRawData; } } @@ -33,7 +31,7 @@ void powerCalculation(long **p, double powerArray[]){ * @param N number of rows in the file * @param M number of columns in the file */ -void powerFunction(char* rawDataFileName, double *pw[]){ +void powerFunction(char* rawDataFileName, double **pw){ long **p = getRawDataArray(rawDataFileName); double pww[nCol-1]; if(p !=NULL){ @@ -42,8 +40,8 @@ void powerFunction(char* rawDataFileName, double *pw[]){ appendDataInFile("powerData.csv",pww,nCol-1); }else{ powerCalculation(p,pw[1]); - appendDataInFile("powerData.csv",*pw,nCol-1); + appendDataInFile("powerData.csv",pw[1],nCol-1); } - freeArray(p,nRow); + freeArray(p,nRowRawData); } } \ No newline at end of file diff --git a/Code-C/simulateFlux.c b/Code-C/simulateFlux.c index 9c0fbd9..c0183af 100644 --- a/Code-C/simulateFlux.c +++ b/Code-C/simulateFlux.c @@ -151,7 +151,7 @@ void *threadSimulateFlux(void *vargp){ FILE *rawDataFile = fopen(fileName,"w+"); while(writeOneRawData(rawDataFile)){ - if(cptData == nRow){ + if(cptData == nRowRawData){ fclose(rawDataFile); cptData = 0; cptFile++;