Commit 7901258d authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Get some nice simulation results, Ok for benchmarking

parent d6a7205f
......@@ -6,6 +6,7 @@
#include <sstream>
#include "ProgressBarr.h"
#include "OptionParser.h"
#include "PImagePng.h"
......@@ -54,7 +55,9 @@ bool simulateImage(const std::string & inputFile, const std::string & outputDir)
colorMap.addColor(0.4, "FF0000");
colorMap.addColor(0.6, "FFFFFF");
ProgressBarr progress(nbImage);
for(size_t i(0lu); i < nbImage; ++i){
progress.progress(i);
float * matValue = fullMat.getTabMat(i);
image.setColor(matValue, nbRow, nbCol, colorMap);
......@@ -66,6 +69,7 @@ bool simulateImage(const std::string & inputFile, const std::string & outputDir)
return false;
}
}
progress.finish();
std::cerr << "Done" << std::endl;
return true;
}
......
......@@ -45,7 +45,6 @@ void naive_propagation(float * outMatU, float * outMatV, const float * matU, con
for(long k(firstRowStencil); k < lastRowStencil; ++k){
long stencilIndexCol(0l);
for(long l(firstColStencil); l < lastColStencil; ++l){
if(k == 1l && l == 1l){continue;}
float deltaSquare(matDeltaSquare[stencilIndexRow*nbStencilCol + stencilIndexCol]);
// float deltaSquare(1.0f);
fullU += (matU[k*nbCol + l] - u)*deltaSquare;
......
......@@ -7,6 +7,7 @@
#include "OptionParser.h"
#include "PTensor.h"
#include "ProgressTime.h"
#include "naive_propagation.h"
#include "MatrixHdf5.h"
......@@ -78,8 +79,9 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
tmpInV.fill(0.0f);
tmpOutV.fill(0.0f);
for(size_t i((2lu*nbRow)/5lu); i < (3lu*nbRow)/5lu; ++i){
for(size_t j((2lu*nbCol)/5lu); j < (3lu*nbCol)/5lu; ++j){
size_t frac(9lu), numBegin(4lu), numEnd(5lu), rowShift(-25lu);
for(size_t i(rowShift + (numBegin*nbRow)/frac); i < rowShift + (numEnd*nbRow)/frac; ++i){
for(size_t j((numBegin*nbCol)/frac); j < (numEnd*nbCol)/frac; ++j){
tmpInU.setValue(i, j, 0.0f);
tmpInV.setValue(i, j, 1.0f);
}
......@@ -91,15 +93,18 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
long nbStencilRow(3l), nbStencilCol(3l);
float diffudionRateU(0.1f), diffusionRateV(0.05f);
float matDeltaSquare[] = {0.05f, 0.2f, 0.05f,
0.2f, -1.0f, 0.2f,
0.05f, 0.2f, 0.05f};
// float matDeltaSquare[] = {1.0f, 1.0f, 1.0f,
// 1.0f, 1.0f, 1.0f,
// 1.0f, 1.0f, 1.0f};
//This matrix of neigbour exchange is quite accurate but gives not so fun results
// float matDeltaSquare[] = {0.05f, 0.2f, 0.05f,
// 0.2f, 0.0f, 0.2f,
// 0.05f, 0.2f, 0.05f};
float matDeltaSquare[] = {1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f};
ProgressTime progress(nbImage);
progress.start();
for(size_t i(0lu); i < nbImage; ++i){
std::cout << "simulateImage n°" << i << "..." << std::endl;
progress.print();
for(size_t j(0lu); j < nbExtraStep; ++j){
float * matInputU = tmpU2;
float * matInputV = tmpV2;
......@@ -125,6 +130,7 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
tmpInV = tmpOutV;
}
}
progress.finish();
std::cerr << "Done" << std::endl;
//Let's save the output file
fullMat.write(outputFile);
......
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