From 41bd738e7679ee095ae15c3b630d856097725063 Mon Sep 17 00:00:00 2001
From: Timon Habenicht <t.habenicht@tu-bs.de>
Date: Sun, 3 Feb 2019 16:57:24 +0100
Subject: [PATCH] adds NumericalTestSimulation

---
 .../Tests/L2NormTest/L2NormTest.cpp           |  3 +--
 .../Tests/L2NormTest/L2NormTest.h             |  8 +++----
 .../L2NormTestBetweenKernels.cpp              |  4 ++--
 .../L2NormTestBetweenKernels.h                | 22 +++++++++----------
 .../Tests/PhiAndNuTest/PhiAndNuTest.cpp       |  2 +-
 .../Tests/PhiAndNuTest/PhiAndNuTest.h         |  8 +++----
 .../NumericalTestSimulation.h                 |  9 ++++++++
 .../NumericalTestSimulation/package.include   |  0
 .../NumericalTests/Utilities/Test/TestImp.cpp |  4 ++--
 .../NumericalTests/Utilities/Test/TestImp.h   | 14 ++++++------
 .../Utilities/TestSimulation/TestSimulation.h |  9 --------
 .../TestSimulation/TestSimulationImp.h        |  3 ++-
 12 files changed, 43 insertions(+), 43 deletions(-)
 create mode 100644 targets/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h
 create mode 100644 targets/tests/NumericalTests/Utilities/NumericalTestSimulation/package.include

diff --git a/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.cpp b/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.cpp
index 54bff0969..4f88a74a9 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.cpp
+++ b/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.cpp
@@ -1,7 +1,6 @@
 #include "L2NormTest.h"
 
 #include "Utilities/ColorConsoleOutput/ColorConsoleOutput.h"
-#include "Utilities\PostProcessingResults\PostProcessingResults.h"
 #include "Utilities\Results\SimulationResults\SimulationResults.h"
 
 #include "Tests\L2NormTest\PostProcessingStrategy\PostProcessingStrategyL2NormTest.h"
@@ -19,7 +18,7 @@ void L2NormTest::update()
 	TestImp::update();
 }
 
-void L2NormTest::addSimulation(std::shared_ptr<TestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr< L2NormPostProcessingStrategy> postProStrategy)
+void L2NormTest::addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<L2NormPostProcessingStrategy> postProStrategy)
 {
 	TestImp::addSimulation(sim, simInfo, postProStrategy);
 	l2NormPostProStrategies.push_back(postProStrategy);
diff --git a/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.h b/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.h
index 5486b4de5..1bc500390 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.h
+++ b/targets/tests/NumericalTests/Tests/L2NormTest/L2NormTest.h
@@ -14,17 +14,17 @@ struct L2NormTestParameterStruct;
 class L2NormTest : public TestImp
 {
 public:
-	static std::shared_ptr<L2NormTest> getNewInstance(std::shared_ptr< ColorConsoleOutput> colorOutput, std::shared_ptr<L2NormTestParameterStruct> testParameter, std::string dataToCalculate);
+	static std::shared_ptr<L2NormTest> getNewInstance(std::shared_ptr<ColorConsoleOutput> colorOutput, std::shared_ptr<L2NormTestParameterStruct> testParameter, std::string dataToCalculate);
 
 	void update();
-	void addSimulation(std::shared_ptr< TestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< L2NormPostProcessingStrategy> postProStrategy);
+	void addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<L2NormPostProcessingStrategy> postProStrategy);
 	void evaluate();
 	std::string getLogFileOutput();
 	std::vector< bool> getPassedTests();
 	void makeConsoleOutput();
 
 private:
-	L2NormTest(std::shared_ptr< ColorConsoleOutput> colorOutput, std::shared_ptr<L2NormTestParameterStruct> testParameter, std::string dataToCalculate);
+	L2NormTest(std::shared_ptr<ColorConsoleOutput> colorOutput, std::shared_ptr<L2NormTestParameterStruct> testParameter, std::string dataToCalculate);
 
 	unsigned int basicTimeStep, divergentTimeStep;
 	double resultBasicTimestep, resultDivergentTimeStep;
@@ -33,6 +33,6 @@ private:
 	double maxL2NormDiff;
 	bool testPassed;
 
-	std::vector<std::shared_ptr< L2NormPostProcessingStrategy>> l2NormPostProStrategies;
+	std::vector<std::shared_ptr<L2NormPostProcessingStrategy> > l2NormPostProStrategies;
 };
 #endif 
\ No newline at end of file
diff --git a/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.cpp b/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.cpp
index 2eec26999..a96d57dbe 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.cpp
+++ b/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.cpp
@@ -83,7 +83,7 @@ void L2NormTestBetweenKernels::makeConsoleOutput()
 	colorOutput->makeL2NormBetweenKernelsTestOutput(testPassed, basicSimInfo, divergentSimInfo, dataToCalculate, timeStep, basicL2Result, divergentL2Result, resultL2ToBasicKernel);
 }
 
-void L2NormTestBetweenKernels::setBasicSimulation(std::shared_ptr<TestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy)
+void L2NormTestBetweenKernels::setBasicSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy)
 {
 	TestImp::addSimulation(sim, simInfo, postProcessingStrategy);
 	this->basicSim = sim;
@@ -92,7 +92,7 @@ void L2NormTestBetweenKernels::setBasicSimulation(std::shared_ptr<TestSimulation
 	this->basicSimResults = basicPostProcessingStrategy->getSimulationResult();
 }
 
-void L2NormTestBetweenKernels::setDivergentKernelSimulation(std::shared_ptr<TestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy)
+void L2NormTestBetweenKernels::setDivergentKernelSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy)
 {
 	TestImp::addSimulation(sim, simInfo, postProcessingStrategy);
 	this->divergentSim = sim;
diff --git a/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.h b/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.h
index 4711f3bb4..5c2640da0 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.h
+++ b/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.h
@@ -22,8 +22,8 @@ public:
 	std::vector< bool> getPassedTests();
 	void makeConsoleOutput();
 
-	void setBasicSimulation(std::shared_ptr< TestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy);
-	void setDivergentKernelSimulation(std::shared_ptr< TestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy);
+	void setBasicSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy);
+	void setDivergentKernelSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> postProcessingStrategy);
 
 private:
 	L2NormTestBetweenKernels(std::shared_ptr< ColorConsoleOutput> colorOutput, std::string dataToCalculate, unsigned int timeStep);
@@ -33,19 +33,19 @@ private:
 	std::string dataToCalculate;
 	bool testPassed;
 
-	std::shared_ptr< TestSimulation> basicSim;
-	std::shared_ptr< SimulationInfo> basicSimInfo;
-	std::shared_ptr< SimulationResults> basicSimResults;
-	std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> basicPostProcessingStrategy;
+	std::shared_ptr<NumericalTestSimulation> basicSim;
+	std::shared_ptr<SimulationInfo> basicSimInfo;
+	std::shared_ptr<SimulationResults> basicSimResults;
+	std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> basicPostProcessingStrategy;
 	double basicL2Result;
 
-	std::shared_ptr< TestSimulation> divergentSim;
-	std::shared_ptr< SimulationInfo> divergentSimInfo;
-	std::shared_ptr< SimulationResults> divergentSimResults;
-	std::shared_ptr< L2NormBetweenKernelPostProcessingStrategy> divergentPostProcessingStrategy;
+	std::shared_ptr<NumericalTestSimulation> divergentSim;
+	std::shared_ptr<SimulationInfo> divergentSimInfo;
+	std::shared_ptr<SimulationResults> divergentSimResults;
+	std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> divergentPostProcessingStrategy;
 	double divergentL2Result;
 	
-	std::shared_ptr< L2NormCalculator> l2Normcalculator;
+	std::shared_ptr<L2NormCalculator> l2Normcalculator;
 
 	double resultL2ToBasicKernel;
 };
diff --git a/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.cpp b/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.cpp
index 5130f1841..efc7160cf 100644
--- a/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.cpp
+++ b/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.cpp
@@ -45,7 +45,7 @@ void PhiAndNuTest::update()
 	TestImp::update();
 }
 
-void PhiAndNuTest::addSimulation(std::shared_ptr<TestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< PhiAndNuTestPostProcessingStrategy> postProStrategy)
+void PhiAndNuTest::addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<PhiAndNuTestPostProcessingStrategy> postProStrategy)
 {
 	TestImp::addSimulation(sim, simInfo, postProStrategy);
 	phiAndNuPostProStrategies.push_back(postProStrategy);
diff --git a/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.h b/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.h
index bd1bf9e19..2378020f6 100644
--- a/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.h
+++ b/targets/tests/NumericalTests/Tests/PhiAndNuTest/PhiAndNuTest.h
@@ -14,10 +14,10 @@ struct PhiAndNuTestParameterStruct;
 class PhiAndNuTest : public TestImp 
 {
 public:
-	static std::shared_ptr<PhiAndNuTest> getNewInstance(std::shared_ptr< ColorConsoleOutput> colorOutput, double viscosity, std::shared_ptr<PhiAndNuTestParameterStruct> testPara, std::string dataToCalculate);
+	static std::shared_ptr<PhiAndNuTest> getNewInstance(std::shared_ptr<ColorConsoleOutput> colorOutput, double viscosity, std::shared_ptr<PhiAndNuTestParameterStruct> testPara, std::string dataToCalculate);
 	
 	void update();
-	void addSimulation(std::shared_ptr< TestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< PhiAndNuTestPostProcessingStrategy> postProStrategy);
+	void addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<PhiAndNuTestPostProcessingStrategy> postProStrategy);
 	void evaluate();
 	std::vector< bool> getPassedTests();
 	void makeConsoleOutput();
@@ -33,10 +33,10 @@ public:
 
 
 private:
-	PhiAndNuTest(std::shared_ptr< ColorConsoleOutput> colorOutput, double viscosity, std::shared_ptr<PhiAndNuTestParameterStruct> testPara, std::string dataToCalculate);
+	PhiAndNuTest(std::shared_ptr<ColorConsoleOutput> colorOutput, double viscosity, std::shared_ptr<PhiAndNuTestParameterStruct> testPara, std::string dataToCalculate);
 	double calcOrderOfAccuracy(std::vector<double> data);
 	bool checkTestPassed(double orderOfAccuracy);
-	std::vector< double> calcNuDiff(std::vector< double> nu);
+	std::vector<double> calcNuDiff(std::vector< double> nu);
 
 	unsigned int startStepCalculation, endStepCalculation;
 	std::vector<double> lx;
diff --git a/targets/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h b/targets/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h
new file mode 100644
index 000000000..e9c964362
--- /dev/null
+++ b/targets/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h
@@ -0,0 +1,9 @@
+#ifndef NUMERICAL_TEST_SIMULATION_H
+#define NUMERICAL_TEST_SIMULATION_H
+
+class NumericalTestSimulation
+{
+public:
+	virtual bool getSimulationRun() = 0;
+};
+#endif
\ No newline at end of file
diff --git a/targets/tests/NumericalTests/Utilities/NumericalTestSimulation/package.include b/targets/tests/NumericalTests/Utilities/NumericalTestSimulation/package.include
new file mode 100644
index 000000000..e69de29bb
diff --git a/targets/tests/NumericalTests/Utilities/Test/TestImp.cpp b/targets/tests/NumericalTests/Utilities/Test/TestImp.cpp
index c40ed92c7..43146f403 100644
--- a/targets/tests/NumericalTests/Utilities/Test/TestImp.cpp
+++ b/targets/tests/NumericalTests/Utilities/Test/TestImp.cpp
@@ -1,7 +1,7 @@
 #include "TestImp.h"
 
 #include "Utilities\PostProcessingStrategy\PostProcessingStrategy.h"
-#include "Utilities\TestSimulation\TestSimulation.h"
+#include "Utilities\NumericalTestSimulation\NumericalTestSimulation.h"
 
 void TestImp::update()
 {
@@ -21,7 +21,7 @@ void TestImp::update()
 		evaluate();				
 }
 
-void TestImp::addSimulation(std::shared_ptr<TestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr<PostProcessingStrategy> postProStrategy)
+void TestImp::addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr<PostProcessingStrategy> postProStrategy)
 {
 	simulations.push_back(sim);
 	simInfos.push_back(simInfo);
diff --git a/targets/tests/NumericalTests/Utilities/Test/TestImp.h b/targets/tests/NumericalTests/Utilities/Test/TestImp.h
index 80d8f20af..ed4e0a6e4 100644
--- a/targets/tests/NumericalTests/Utilities/Test/TestImp.h
+++ b/targets/tests/NumericalTests/Utilities/Test/TestImp.h
@@ -6,7 +6,7 @@
 #include <vector>
 #include <memory>
 
-class TestSimulation;
+class NumericalTestSimulation;
 class SimulationResults;
 class SimulationInfo;
 class ColorConsoleOutput;
@@ -16,7 +16,7 @@ class TestImp : public Test
 {
 public:
 	void update();
-	void addSimulation(std::shared_ptr< TestSimulation> sim, std::shared_ptr< SimulationInfo> simInfo, std::shared_ptr< PostProcessingStrategy> postProStrategy);
+	void addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<PostProcessingStrategy> postProStrategy);
 
 	virtual void evaluate() = 0;
 	virtual std::vector< bool> getPassedTests() = 0;
@@ -28,11 +28,11 @@ protected:
 	TestImp(std::shared_ptr< ColorConsoleOutput> colorOutput);
 	bool CheckAllSimulationRun();
 
-	std::vector< bool> simulationRun;
-	std::shared_ptr< ColorConsoleOutput> colorOutput;
-	std::vector< std::shared_ptr< TestSimulation>> simulations;
-	std::vector< std::shared_ptr< PostProcessingStrategy>> postProStrategies;
-	std::vector< std::shared_ptr< SimulationInfo>> simInfos;
+	std::vector<std::shared_ptr<NumericalTestSimulation> > simulations;
+	std::vector<std::shared_ptr<PostProcessingStrategy> > postProStrategies;
+	std::vector<std::shared_ptr<SimulationInfo> > simInfos;
+	std::vector<bool> simulationRun;
+	std::shared_ptr<ColorConsoleOutput> colorOutput;
 
 	std::string kernelName;
 	std::string simulationName;
diff --git a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h
index bc6262afc..dad280c10 100644
--- a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h
+++ b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h
@@ -6,7 +6,6 @@
 #include <memory>
 #include <string>
 
-class AnalyticalResults;
 class InitialCondition;
 class DataWriter;
 class SimulationParameter;
@@ -18,18 +17,10 @@ class Parameter;
 class TestSimulation : public NumericalTestSuite
 {
 public:
-	//beachte Interface Segregation
-	//TimeStopper
-
 	virtual std::shared_ptr<SimulationParameter> getSimulationParameter() = 0;
 	virtual std::shared_ptr<DataWriter> getDataWriter() = 0;
 	virtual std::shared_ptr<InitialCondition> getInitialCondition() = 0;
 	virtual std::shared_ptr<TimeTracking> getTimeTracking() = 0;
 	virtual void setParameter(std::shared_ptr<Parameter> para) = 0;
-
-	virtual bool getSimulationRun() = 0;
-
-	virtual void makeSimulationHeadOutput() = 0;
-	virtual void startPostProcessing() = 0;
 };
 #endif
\ No newline at end of file
diff --git a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h
index 9038c7a06..4b97004c6 100644
--- a/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h
+++ b/targets/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h
@@ -2,6 +2,7 @@
 #define TEST_SIMULATION_IMP_H
 
 #include "TestSimulation.h"
+#include "Utilities\NumericalTestSimulation\NumericalTestSimulation.h"
 
 #include <vector>
 #include <time.h>
@@ -16,7 +17,7 @@ class TimeTracking;
 
 struct TestSimulationDataStruct;
 
-class TestSimulationImp : public TestSimulation
+class TestSimulationImp : public TestSimulation, public NumericalTestSimulation
 {
 public:
 	static std::shared_ptr< TestSimulationImp> getNewInsance(std::shared_ptr<TestSimulationDataStruct> testSimData, std::shared_ptr<SimulationResults> simResult, std::shared_ptr<TimeTracking> timeTracking, std::shared_ptr<ToVectorWriter> toVectorWriter, std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter, std::shared_ptr<ColorConsoleOutput> colorOutput);
-- 
GitLab