diff --git a/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.cpp b/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.cpp index 98604286ff26d26e6d5d68025d9e5991fb15e54d..baf3bb26c3bd349193cd8b2954d0eb34cc554971 100644 --- a/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.cpp +++ b/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.cpp @@ -2,12 +2,12 @@ #include <sstream> -std::shared_ptr<SimulationInfo> ShearWaveSimulationInfo::getNewInstance(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName) +std::shared_ptr<SimulationInfo> ShearWaveSimulationInfo::getNewInstance(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations) { - return std::shared_ptr<SimulationInfo>(new ShearWaveSimulationInfo(u0, v0, l0, lx, viscosity, kernelName)); + return std::shared_ptr<SimulationInfo>(new ShearWaveSimulationInfo(u0, v0, l0, lx, viscosity, kernelName, numberOfSimulations)); } -ShearWaveSimulationInfo::ShearWaveSimulationInfo(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName) : SimulationInfoImp(lx, viscosity, kernelName) +ShearWaveSimulationInfo::ShearWaveSimulationInfo(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations) : SimulationInfoImp(lx, viscosity, kernelName, numberOfSimulations) { std::ostringstream oss; oss << " u0: " << u0 / (lx / l0) << " v0: " << v0 / (lx / l0); diff --git a/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.h b/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.h index 4919bb25a399534746460197ca0dcd24b8946cd9..3ddf46d38396412d36b0f70fede54de7a3e4a363 100644 --- a/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.h +++ b/targets/tests/NumericalTests/Simulation/ShearWave/SimulationInfo/ShearWaveSimulationInfo.h @@ -8,10 +8,10 @@ class ShearWaveSimulationInfo : public SimulationInfoImp { public: - static std::shared_ptr< SimulationInfo> getNewInstance(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName); + static std::shared_ptr< SimulationInfo> getNewInstance(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations); private: ShearWaveSimulationInfo() {}; - ShearWaveSimulationInfo(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName); + ShearWaveSimulationInfo(double u0, double v0, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations); }; #endif \ No newline at end of file diff --git a/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.cpp b/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.cpp index 5f6ca53b3110f46afdbe70e1b3be638ffe5425c4..a657bfcc9b5c41eb22cdfb1b37bf32be82c36f5e 100644 --- a/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.cpp +++ b/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.cpp @@ -2,12 +2,12 @@ #include <sstream> -std::shared_ptr<SimulationInfo> TaylorGreenVortexSimulationInfo::getNewInstance(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName) +std::shared_ptr<SimulationInfo> TaylorGreenVortexSimulationInfo::getNewInstance(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations) { - return std::shared_ptr<SimulationInfo>(new TaylorGreenVortexSimulationInfo(u0, amplitude, l0, lx, viscosity, kernelName)); + return std::shared_ptr<SimulationInfo>(new TaylorGreenVortexSimulationInfo(u0, amplitude, l0, lx, viscosity, kernelName, numberOfSimulations)); } -TaylorGreenVortexSimulationInfo::TaylorGreenVortexSimulationInfo(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName) : SimulationInfoImp(lx, viscosity, kernelName) +TaylorGreenVortexSimulationInfo::TaylorGreenVortexSimulationInfo(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations) : SimulationInfoImp(lx, viscosity, kernelName, numberOfSimulations) { std::ostringstream oss; oss << " u0: " << u0 / (lx / l0) << " Amplitude: " << amplitude / (lx / l0); diff --git a/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.h b/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.h index 078e3e333f174045b0397588cc6e630d288d8135..bfc4953e41aa903308c2714adea73a471f96cd98 100644 --- a/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.h +++ b/targets/tests/NumericalTests/Simulation/TaylorGreenVortex/SimulationInfo/TaylorGreenVortexSimulationInfo.h @@ -8,11 +8,11 @@ class TaylorGreenVortexSimulationInfo : public SimulationInfoImp { public: - static std::shared_ptr< SimulationInfo> getNewInstance(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName); + static std::shared_ptr< SimulationInfo> getNewInstance(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations); private: TaylorGreenVortexSimulationInfo() {}; - TaylorGreenVortexSimulationInfo(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName); + TaylorGreenVortexSimulationInfo(double u0, double amplitude, int l0, int lx, double viscosity, std::string kernelName, int numberOfSimulations); }; #endif \ No newline at end of file diff --git a/targets/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp b/targets/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp index 1a3e11d3de22fd63be0f9ebabc3e1d14d4b7b6b6..decf403ce97046d4332d7556ab00cbc703cbf0bc 100644 --- a/targets/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp +++ b/targets/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp @@ -128,6 +128,9 @@ void ColorConsoleOutputImp::makeL2NormTestOutput(bool testPassed, std::shared_pt void ColorConsoleOutputImp::makeSimulationHeadOutput(std::shared_ptr< SimulationInfo> simInfo) { + std::ostringstream ossLine0; + ossLine0 << "# Simulation Number " << simInfo->getSimulationID() << " of " << std::setfill(' ') << std::left << std::setw(23) << simInfo->getNumberOfSimulations() << "#"; + std::ostringstream ossLine1; ossLine1 << "# Kernel: " << std::setfill(' ') << std::left << std::setw(38) << simInfo->getKernelName() << "#"; @@ -151,6 +154,7 @@ void ColorConsoleOutputImp::makeSimulationHeadOutput(std::shared_ptr< Simulation ossLine6 << "# DATE: " << std::setfill('0') << std::setw(2) << nowLocal.tm_mday << "." << std::setw(2) << nowLocal.tm_mon + 1 << "." << nowLocal.tm_year + 1900 << " TIME: " << std::setw(2) << nowLocal.tm_hour << ":" << std::setw(2) << nowLocal.tm_min << ":" << std::setw(2) << nowLocal.tm_sec << "\t" << "\t#"; printGreenHashLine(); + printGreen(ossLine0.str()); printGreen(ossLine1.str()); printGreen(ossLine2.str()); printGreen(ossLine3.str()); diff --git a/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp b/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp index 747bdd6466818936cb20d122a3d257b046888f8c..dedd08461f57f9e2f22162ef91f4596aaf097043 100644 --- a/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp +++ b/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp @@ -54,12 +54,14 @@ std::shared_ptr<LogFileQueue> NumericalTestFactoryImp::getLogFileQueue() void NumericalTestFactoryImp::init() { + calcNumberOfSimulations(); + simID = 1; for (int i = 0; i < cfd->kernelsToTest.size(); i++) { - simID = 1; for (int j = 0; j < cfd->viscosity.size(); j++) { for (int k = 0; k < cfd->u0TGV.size(); k++) { - if (shouldSimulationGroupRun(cfd->tgv)) + if (shouldSimulationGroupRun(cfd->tgv)) { makeTaylorGreenSimulations(cfd->kernelsToTest.at(i), cfd->viscosity.at(j), cfd->u0TGV.at(k), cfd->amplitudeTGV.at(k)); + } } for (int k = 0; k < cfd->u0SW.size(); k++) { if (shouldSimulationGroupRun(cfd->sw)) @@ -78,7 +80,7 @@ void NumericalTestFactoryImp::makeTaylorGreenSimulations(std::string kernelName, for (int i = 0; i < cfd->tgv.size(); i++) { if (cfd->tgv.at(i)) { simParaTGV.push_back(TaylorGreenSimulationParameter::getNewInstance(kernelName, u0, amplitude, viscosity, cfd->rho0, cfd->lx.at(i), cfd->lz.at(i), cfd->l0, cfd->numberOfTimeSteps, cfd->basisTimeStepLength, calcStartStepForToVectorWriter(), cfd->ySliceForCalculation, cfd->grids.at(i), cfd->maxLevel, cfd->numberOfGridLevels, cfd->writeFiles, cfd->startStepFileWriter, cfd->filePath, cfd->devices)); - simInfoTGV.push_back(TaylorGreenVortexSimulationInfo::getNewInstance(u0, amplitude, cfd->l0, cfd->lx.at(i), viscosity, kernelName)); + simInfoTGV.push_back(TaylorGreenVortexSimulationInfo::getNewInstance(u0, amplitude, cfd->l0, cfd->lx.at(i), viscosity, kernelName, numberOfSimulations)); analyResultTGV.push_back(TaylorGreenAnalyticalResults::getNewInstance(viscosity, u0, amplitude, cfd->l0, cfd->rho0)); } } @@ -96,7 +98,7 @@ void NumericalTestFactoryImp::makeShearWaveSimulations(std::string kernelName, d for (int i = 0; i < cfd->sw.size(); i++) if (cfd->sw.at(i)) { simParaSW.push_back(ShearWaveSimulationParameter::getNewInstance(kernelName, u0, v0, viscosity, cfd->rho0, cfd->lx.at(i), cfd->lz.at(i), cfd->l0, cfd->numberOfTimeSteps, cfd->basisTimeStepLength, calcStartStepForToVectorWriter(), cfd->ySliceForCalculation, cfd->grids.at(i), cfd->maxLevel, cfd->numberOfGridLevels, cfd->writeFiles, cfd->startStepFileWriter, cfd->filePath, cfd->devices)); - simInfoSW.push_back(ShearWaveSimulationInfo::getNewInstance(u0, v0, cfd->l0, cfd->lx.at(i), viscosity, kernelName)); + simInfoSW.push_back(ShearWaveSimulationInfo::getNewInstance(u0, v0, cfd->l0, cfd->lx.at(i), viscosity, kernelName, numberOfSimulations)); analyResultSW.push_back(ShearWaveAnalyticalResults::getNewInstance(viscosity, u0, v0, cfd->l0, cfd->rho0)); } @@ -211,3 +213,27 @@ bool NumericalTestFactoryImp::checkNuAndPhiTestCouldRun(std::vector<bool> test) } return numberOfTestInGroup > 1; } + +void NumericalTestFactoryImp::calcNumberOfSimulations() +{ + int counter = 0; + + int tgvCounter = 0; + for (int i = 0; i < cfd->tgv.size(); i++) + if (cfd->tgv.at(i)) + tgvCounter++; + tgvCounter *= cfd->u0TGV.size(); + counter += tgvCounter; + + int swCounter = 0; + for (int i = 0; i < cfd->sw.size(); i++) + if (cfd->sw.at(i)) + swCounter++; + swCounter *= cfd->u0SW.size(); + counter += swCounter; + + counter *= cfd->viscosity.size(); + counter *= cfd->kernelsToTest.size(); + + numberOfSimulations = counter; +} diff --git a/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h b/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h index ab1e045a7cdba315eb730f71d2085c3336811b8f..a6d1350369360445306376a16cc891c5d008f585 100644 --- a/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h +++ b/targets/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h @@ -41,6 +41,7 @@ private: bool shouldSimulationGroupRun(std::vector<bool> test); unsigned int calcStartStepForToVectorWriter(); bool checkNuAndPhiTestCouldRun(std::vector<bool> test); + void calcNumberOfSimulations(); std::shared_ptr<ConfigDataStruct> cfd; std::vector< std::shared_ptr< TestSimulation>> testSimulations; @@ -49,5 +50,6 @@ private: std::shared_ptr< ColorConsoleOutput> colorOutput; int simID; + int numberOfSimulations; }; #endif \ No newline at end of file diff --git a/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h b/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h index a5a34a9631b22c8e69d2be91f0aa306d16743a1c..20dcb080822e697c4747bd6ea5d055984e2cdb71 100644 --- a/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h +++ b/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h @@ -11,6 +11,9 @@ public: virtual std::string getSimulationName() = 0; virtual std::string getSimulationParameterString() = 0; virtual int getLx() = 0; + virtual int getNumberOfSimulations() = 0; + virtual int getSimulationID() = 0; + virtual void setSimulationID(int simID) = 0; private: diff --git a/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.cpp b/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.cpp index f65524016a66ef064bfbe62d1f8ef6c59b8e54e4..bab0db90308ec486c7223d41dba7e67843bcfd94 100644 --- a/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.cpp +++ b/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.cpp @@ -25,6 +25,21 @@ int SimulationInfoImp::getLx() return lx; } -SimulationInfoImp::SimulationInfoImp(int lx, double viscosity, std::string kernelName) : lx(lx), viscosity(viscosity), kernelName(kernelName) +int SimulationInfoImp::getNumberOfSimulations() +{ + return numberOfSimulations; +} + +int SimulationInfoImp::getSimulationID() +{ + return simID; +} + +void SimulationInfoImp::setSimulationID(int simID) +{ + this->simID = simID; +} + +SimulationInfoImp::SimulationInfoImp(int lx, double viscosity, std::string kernelName, int numberOfSimulations) : lx(lx), viscosity(viscosity), kernelName(kernelName), numberOfSimulations(numberOfSimulations) { } diff --git a/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.h b/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.h index 309bfddc8d19962ca8b4629754cfedecf8bae53b..460afbe60c79842d8aa38c76468dcc91c876f228 100644 --- a/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.h +++ b/targets/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfoImp.h @@ -11,16 +11,20 @@ public: std::string getSimulationName(); std::string getSimulationParameterString(); int getLx(); + int getNumberOfSimulations(); + int getSimulationID(); + void setSimulationID(int simID); protected: SimulationInfoImp() {}; - SimulationInfoImp(int lx, double viscosity, std::string kernelName); + SimulationInfoImp(int lx, double viscosity, std::string kernelName, int numberOfSimulations); double viscosity; std::string kernelName; std::string simulationName; std::string simulationParameterString; int lx; + int numberOfSimulations, simID; private: diff --git a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp index 371065a43128a0c907f5d9132932dbeb13022057..c36a1ca857ebed96225ad7b4ebb4c1230d90e1ae 100644 --- a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp +++ b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp @@ -101,6 +101,7 @@ TestSimulationImp::TestSimulationImp(int simID, std::shared_ptr< SimulationParam { this->simPara = simPara; this->simInfo = simInfo; + this->simInfo->setSimulationID(simID); simResults = SimulationResults::getNewInstance(simPara->getLx(), 1, simPara->getLz(), simPara->getTimeStepLength()); writeToVector = std::shared_ptr<ToVectorWriter>(new Y2dSliceToResults(simResults, simPara->getYSliceForCalculation(), simPara->getStartTimeCalculation(), simPara->getEndTime(), simPara->getTimeStepLength(), simPara->getWriteFiles(), std::shared_ptr<FileWriter>(new FileWriter()), simPara->getStartTimeDataWriter()));