/*************************************** Auteur : Pierre Aubert Mail : aubertp7@gmail.com Licence : CeCILL-C ****************************************/ #include "tbb/task_scheduler_init.h" #include "tbb/tick_count.h" #include "OptionParser.h" #include "temporary_alloc.h" #include "ProgressTime.h" #include "intrinsics_propagation_link_block_parallel.h" #include "MatrixHdf5.h" ///Create the OptionParser of this program /** @return OptionParser of this program */ OptionParser createOptionParser(){ OptionParser parser(true, __PROGRAM_VERSION__); parser.setExampleLongOption("intrinsics_link_block_parallel_gray_scott --killrate=0.062 --feedrate=0.03 --nbimage=100 --nbrow=1080 --nbcol=1920 --output=outputFile.hdf5"); parser.setExampleShortOption("intrinsics_link_block_parallel_gray_scott -k 0.062 -f 0.03 -n 100 -r 1080 -c 1920 -o outputFile.hdf5"); float killRate(0.054f), feedRate(0.014f); size_t nbImage(100lu), nbRow(100lu), nbCol(200lu); parser.addOption("killrate", "k", killRate, "rate of the process which converts V into P"); parser.addOption("feedrate", "f", feedRate, "rate of the process which feeds U and drains U, V and P"); parser.addOption("nbimage", "n", nbImage, "number of images to be created"); size_t nbExtraStep(1lu); parser.addOption("nbextrastep", "e", nbExtraStep, "number of extra steps to be computed between images"); parser.addOption("nbrow", "r", nbRow, "number of rows of the images to be created"); parser.addOption("nbcol", "c", nbCol, "number of columns of the images to be created"); float dt(1.0f); parser.addOption("deltat", "t", dt, "time interval between two computation"); size_t blockSizeRow(72lu), blockSizeCol(127lu); parser.addOption("blocksizerow", "l", blockSizeRow, "number of rows of the blocks"); parser.addOption("blocksizecol", "m", blockSizeCol, "number of columns of the blocks"); size_t nbThread(0lu); parser.addOption("nbthread", "d", nbThread, "number of threads to be used"); std::string defaultOutputFile("output.h5"); parser.addOption("output", "o", defaultOutputFile, "Output file to be created with results"); return parser; } ///Simulate the images /** @param nbRow : number of rows of the images to be created * @param nbCol : number of columns of the images to be created * @param nbImage : number of images to be created * @param nbExtraStep : number of extra steps to be computed between images * @param killRate : rate of the process which converts V into P * @param feedRate : rate of the process which feeds U and drains U, V and P * @param dt : time interval between two computation * @param outputFile : name of the file to be created * @param blockSizeRow : number of rows of the blocks * @param blockSizeCol : number of columns of the blocks * @param nbThread : number of thread to be used * @return true on succsess, false otherwise */ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraStep, float killRate, float feedRate, float dt, const std::string & outputFile, size_t blockSizeRow, size_t blockSizeCol, size_t nbThread) { std::cout << "simulateImage : nbImage = "<