diff --git a/targets/tests/NumericalTests/Utilities/LogFileInformation/LogFileTimeInformation/LogFileTimeInformation.cpp b/targets/tests/NumericalTests/Utilities/LogFileInformation/LogFileTimeInformation/LogFileTimeInformation.cpp index 74a6ffcf0b47f0d93b2a4b22407bce2b20edd680..fd4331d3e61697817523a2b9321081795ff318ac 100644 --- a/targets/tests/NumericalTests/Utilities/LogFileInformation/LogFileTimeInformation/LogFileTimeInformation.cpp +++ b/targets/tests/NumericalTests/Utilities/LogFileInformation/LogFileTimeInformation/LogFileTimeInformation.cpp @@ -2,6 +2,8 @@ #include "Utilities\TestSimulation\TestSimulation.h" +#include <iomanip> + std::shared_ptr<LogFileTimeInformation> LogFileTimeInformation::getNewInstance(std::vector<std::shared_ptr<TestSimulation>> testSimulation, bool fileWriting) { return std::shared_ptr<LogFileTimeInformation>(new LogFileTimeInformation(testSimulation, fileWriting)); @@ -12,10 +14,10 @@ std::string LogFileTimeInformation::getOutput() makeCenterHead("Simulation Time Information"); oss << "FileWriting: " << std::boolalpha << fileWriting <<std::endl; oss << std::endl; - oss << "TestName \t \t \t" << " L\t\t" << "Time for Test" << std::endl; + oss << std::left << std::setfill(' ') << std::setw(11) << "" << "TestName \t \t \t" << " L\t\t" << "Time for Test" << std::endl; oss << std::endl; for (int i = 0; i < testSimulation.size(); i++) - oss << testSimulation.at(i)->getSimulationRunTimeOutput(); + oss << testSimulation.at(i)->getRunTimeOutput(); oss << std::endl; return oss.str(); } diff --git a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h index 9c8353a2afb5ed2d669967a9ae47ed7a468ef1c9..ffbf2d909c85b0bc6e7915dd5ae4521b65c86152 100644 --- a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h +++ b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h @@ -20,13 +20,15 @@ public: virtual std::shared_ptr< SimulationResults> getSimulationResults() = 0; virtual bool getSimulationRun() = 0; - virtual std::string getSimulationRunTimeOutput() = 0; + virtual std::string getRunTimeOutput() = 0; virtual void registerSimulationObserver(std::shared_ptr< SimulationObserver> simObserver) = 0; - virtual void makeSimulationHeadOutput() = 0; - virtual void setStartTime() = 0; - virtual void setEndTime() = 0; + virtual void setSimulationStartTime() = 0; + virtual void setSimulationEndTimeAndNotifyObserver() = 0; + + virtual void setTestStartTime() = 0; + virtual void setTestEndTime() = 0; private: diff --git a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp index 7efa4735b8770ddffe621216b73858e1c07bb098..2fa45ed11f7a3e5d8278f23bbd824a2c6900d9d1 100644 --- a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp +++ b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp @@ -13,7 +13,6 @@ #include <sstream> #include <iomanip> - std::shared_ptr<TestSimulation> TestSimulationImp::getNewInsance(int simID, std::shared_ptr< SimulationParameter> simPara, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< ColorConsoleOutput> colorOutput) { return std::shared_ptr< TestSimulation>(new TestSimulationImp(simID, simPara, simInfo, colorOutput)); @@ -52,7 +51,12 @@ void TestSimulationImp::notifyObserver() double TestSimulationImp::calcSimTime() { - return difftime(endTime, startTime); + return difftime(simulationEndTime, simulationStartTime); +} + +double TestSimulationImp::calcTestTime() +{ + return difftime(testEndTime, testStartTime); } void TestSimulationImp::makeSimulationHeadOutput() @@ -60,22 +64,33 @@ void TestSimulationImp::makeSimulationHeadOutput() colorOutput->makeSimulationHeadOutput(simInfo); } -void TestSimulationImp::setStartTime() +void TestSimulationImp::setSimulationStartTime() { - startTime = time(NULL); + simulationStartTime = time(NULL); } -void TestSimulationImp::setEndTime() +void TestSimulationImp::setSimulationEndTimeAndNotifyObserver() { - endTime = time(NULL); + simulationEndTime = time(NULL); simualtionRun = true; notifyObserver(); } -std::string TestSimulationImp::getSimulationRunTimeOutput() +void TestSimulationImp::setTestStartTime() +{ + testStartTime = time(NULL); +} + +void TestSimulationImp::setTestEndTime() +{ + testEndTime = time(NULL); +} + +std::string TestSimulationImp::getRunTimeOutput() { std::ostringstream oss; - oss << std::left << std::setfill(' ') << std::setw(17) << simInfo->getSimulationName() << "\t" << std::right << std::setw(3) << simPara->getLx() << "\t\t" << std::setw(9) << calcSimTime() << " sec" << std::endl; + oss << std::left << std::setfill(' ') << std::setw(11) << "Simulation" << std::setw(17) << simInfo->getSimulationName() << "\t" << std::right << std::setw(3) << simPara->getLx() << "\t\t" << std::setw(9) << calcSimTime() << " sec" << std::endl; + oss << std::left << std::setfill(' ') << std::setw(11) << "Test" << std::setw(17) << simInfo->getSimulationName() << "\t" << std::right << std::setw(3) << simPara->getLx() << "\t\t" << std::setw(9) << calcTestTime() << " sec" << std::endl; return oss.str(); } diff --git a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h index c891de58273cd10b7a872a65ecdda8d15a17127d..5a63d60a4d18391326ec72edf37eda5cbe08b437 100644 --- a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h +++ b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h @@ -23,14 +23,17 @@ public: std::shared_ptr< SimulationResults> getSimulationResults(); void makeSimulationHeadOutput(); - void setStartTime(); - void setEndTime(); - std::string getSimulationRunTimeOutput(); + void setSimulationStartTime(); + void setSimulationEndTimeAndNotifyObserver(); + void setTestStartTime(); + void setTestEndTime(); + std::string getRunTimeOutput(); private: TestSimulationImp(int simID, std::shared_ptr< SimulationParameter> simPara, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< ColorConsoleOutput> colorOutput); void notifyObserver(); double calcSimTime(); + double calcTestTime(); std::shared_ptr< SimulationParameter> simPara; std::shared_ptr< SimulationInfo> simInfo; @@ -40,7 +43,8 @@ private: std::vector< std::shared_ptr< SimulationObserver>> simObserver; bool simualtionRun; - time_t startTime, endTime; + time_t simulationStartTime, simulationEndTime; + time_t testStartTime, testEndTime; int simID; }; #endif \ No newline at end of file diff --git a/targets/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.cpp b/targets/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.cpp index a1ded12094ce3aa0a6bea7e65aa2c30e50e99b52..f5018283d51d074a45288a5a3b4b4aef42fbe808 100644 --- a/targets/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.cpp +++ b/targets/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.cpp @@ -14,14 +14,14 @@ void VirtualFluidSimulationImp::run() { testSim->makeSimulationHeadOutput(); - testSim->setStartTime(); + testSim->setSimulationStartTime(); Simulation sim; sim.init(para, grid, dataWriter); sim.run(); sim.free(); - testSim->setEndTime(); + testSim->setSimulationEndTimeAndNotifyObserver(); } std::shared_ptr<VirtualFluidSimulationImp> VirtualFluidSimulationImp::getNewInstance() diff --git a/targets/tests/NumericalTests/config.txt b/targets/tests/NumericalTests/config.txt index 4edca80a3481e13f29a8d3734de67eeb0ebea937..ea0aef7e1fc9c31fb5110e2a975961fa9b49bd53 100644 --- a/targets/tests/NumericalTests/config.txt +++ b/targets/tests/NumericalTests/config.txt @@ -57,7 +57,7 @@ L2NormTest_SW=true # Simulation To Perform # ################################################## TaylorGreenVortex32=true -TaylorGreenVortex64=true +TaylorGreenVortex64=false TaylorGreenVortex128=false TaylorGreenVortex256=false TaylorGreenVortex512=false diff --git a/targets/tests/NumericalTests/main.cpp b/targets/tests/NumericalTests/main.cpp index 8c0697cab3d684c7bcb6a9f2ef6f7662f4f8915f..77ef04a17fd12bca95a19151be017f2ed488e581 100644 --- a/targets/tests/NumericalTests/main.cpp +++ b/targets/tests/NumericalTests/main.cpp @@ -5,6 +5,7 @@ #include "Utilities\LogFileQueue\LogFileQueue.h" #include "Utilities\NumericalTestFactory\NumericalTestFactoryImp.h" #include "Utilities\TestQueue\TestQueue.h" +#include "Utilities\TestSimulation\TestSimulation.h" #include "Utilities\VirtualFluidSimulation\VirtualFluidSimulation.h" #include "Utilities\VirtualFluidSimulationFactory\VirtualFluidSimulationFactoryImp.h" @@ -23,8 +24,12 @@ static void startNumericalTests(const std::string &configFile) for (int i = 0; i < vfSimulations.size(); i++) { + if (i > 0) + testSim.at(i)->setTestEndTime(); vfSimulations.at(i)->run(); + testSim.at(i)->setTestStartTime(); } + testSim.at(testSim.size()-1)->setTestEndTime(); testQueue->makeFinalOutput(); logFileQueue->writeLogFiles();