From 0a756bdd8b8a3fb502139c2dbba6384e6eece5ac Mon Sep 17 00:00:00 2001
From: Timon Habenicht <t.habenicht@tu-bs.de>
Date: Sat, 9 Feb 2019 21:17:28 +0100
Subject: [PATCH] adds dataToCalc to L2Norm and L2NormBetweenKernel

---
 .../LogFileInformation/L2NormLogFileInformation.cpp      | 9 +++++++++
 .../LogFileInformation/L2NormLogFileInformation.h        | 1 +
 .../L2NormTestBetweenKernels.cpp                         | 6 +++---
 .../L2NormLogFileInformationBetweenKernels.cpp           | 2 +-
 .../BasicTestLogFileInformation.cpp                      | 1 +
 targets/tests/NumericalTests/config.txt                  | 9 ++++-----
 6 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.cpp b/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.cpp
index 5f064a54b..50bf699a0 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.cpp
+++ b/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.cpp
@@ -19,6 +19,14 @@ std::string L2NormInformation::getOutput()
 
 	oss << "BasicTimeStep_L2Norm=" << basicTimeStep << std::endl;
 	oss << "DivergentTimeStep_L2Norm=" << divergentTimeStep << std::endl;
+	oss << "DataToCalc_L2Norm=\"";
+	for (int i = 0; i < dataToCalc.size(); i++) {
+		oss << dataToCalc.at(i);
+		if (i < dataToCalc.size() - 1)
+			oss << " ";
+		else
+			oss << "\"" << std::endl;
+	}
 	oss << std::endl;
 
 	for (int i = 0; i < tests.size(); i++)
@@ -31,4 +39,5 @@ L2NormInformation::L2NormInformation(std::vector<std::shared_ptr<L2NormTest> > t
 {
 	basicTimeStep = testParameter->basicTimeStep;
 	divergentTimeStep = testParameter->divergentTimeStep;
+	dataToCalc = testParameter->basicTestParameter->dataToCalc;
 }
\ No newline at end of file
diff --git a/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.h b/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.h
index 12fa87bef..ccba54188 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.h
+++ b/targets/tests/NumericalTests/Tests/L2NormTest/LogFileInformation/L2NormLogFileInformation.h
@@ -23,5 +23,6 @@ private:
 	std::vector<std::shared_ptr<L2NormTest> > tests;
 
 	unsigned int basicTimeStep, divergentTimeStep;
+	std::vector<std::string> dataToCalc;
 };
 #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 09bf1b204..eb51948b2 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.cpp
+++ b/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.cpp
@@ -52,7 +52,7 @@ void L2NormTestBetweenKernels::evaluate()
 		resultL2ToBasicKernel = l2Normcalculator->calc(basicSimResults->getRho().at(tS), divergentSimResults->getRho().at(tS), basicSimResults->getLevels().at(tS), basicSimResults->getNumberOfXNodes(), basicSimResults->getNumberOfZNodes(), basicSimResults->getTimeStepLength());
 	}
 
-	if (basicL2Result < divergentL2Result)
+	if (basicL2Result <= divergentL2Result)
 			testPassed = true;
 
 	makeConsoleOutput();
@@ -61,8 +61,8 @@ void L2NormTestBetweenKernels::evaluate()
 std::string L2NormTestBetweenKernels::getLogFileOutput()
 {
 	std::ostringstream oss;
-	oss << "L2Norm_" << dataToCalculate << "_TimeStep_" << timeStep << "=" << divergentL2Result << std::endl;
-	oss << "L2Norm_BasicKernel_" << dataToCalculate << "_TimeStep_" << timeStep << "=" << basicL2Result << std::endl;
+	oss << "L2Norm_BasicKernel_" << dataToCalculate << "_TimeStep_" << timeStep << "_L" << basicPostProcessingStrategy->getNumberOfXNodes() << "=" << basicL2Result << std::endl;
+	oss << "L2Norm_DivergentKernel_" << dataToCalculate << "_TimeStep_" << timeStep << "_L" << basicPostProcessingStrategy->getNumberOfXNodes() << "=" << divergentL2Result << std::endl;
 	oss << "L2Norm_Between_Kernels_" << dataToCalculate << "_TimeStep_" << timeStep << "_L" << basicPostProcessingStrategy->getNumberOfXNodes() << "=" << resultL2ToBasicKernel << std::endl << std::endl;
 	
 	return oss.str();
diff --git a/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/LogFileInformation/L2NormLogFileInformationBetweenKernels.cpp b/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/LogFileInformation/L2NormLogFileInformationBetweenKernels.cpp
index cbce9ee2b..65918efbf 100644
--- a/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/LogFileInformation/L2NormLogFileInformationBetweenKernels.cpp
+++ b/targets/tests/NumericalTests/Tests/L2NormTestBetweenKernels/LogFileInformation/L2NormLogFileInformationBetweenKernels.cpp
@@ -18,7 +18,7 @@ std::string L2NormBetweenKernelsInformation::getOutput()
 	makeCenterHead(headName.str());
 
 	oss << "BasicKernel=" << basicKernel << std::endl;
-	oss << "DataToCalculate=\"";
+	oss << "DataToCalculate_L2Norm_BK=\"";
 	for (int i = 0; i < dataToCalc.size(); i++)
 		oss << dataToCalc.at(i) << " ";
 	deleteLastCharInOss();
diff --git a/targets/tests/NumericalTests/Utilities/LogFileInformation/BasicTestLogFileInformation/BasicTestLogFileInformation.cpp b/targets/tests/NumericalTests/Utilities/LogFileInformation/BasicTestLogFileInformation/BasicTestLogFileInformation.cpp
index b86f9e364..8bf0b9b06 100644
--- a/targets/tests/NumericalTests/Utilities/LogFileInformation/BasicTestLogFileInformation/BasicTestLogFileInformation.cpp
+++ b/targets/tests/NumericalTests/Utilities/LogFileInformation/BasicTestLogFileInformation/BasicTestLogFileInformation.cpp
@@ -18,6 +18,7 @@ std::string BasicTestLogFileInformation::getOutput()
 void BasicTestLogFileInformation::addTest(std::string testName, bool testRun)
 {
 	bool isRegistered = false;
+
 	for (int i = 0; i < this->testName.size(); i++) {
 		if (this->testName.at(i) == testName)
 			isRegistered = true;
diff --git a/targets/tests/NumericalTests/config.txt b/targets/tests/NumericalTests/config.txt
index e0bec2e25..6a31364f0 100644
--- a/targets/tests/NumericalTests/config.txt
+++ b/targets/tests/NumericalTests/config.txt
@@ -6,8 +6,7 @@ Devices="1"
 ##################################################
 #	       Basic Simulation Parameter			 #
 ##################################################
-KernelsToTest="CumulantOneCompSP27"
- CumulantAA2016CompSP27 CumulantAll4CompSP27"
+KernelsToTest="CumulantOneCompSP27 CumulantAA2016CompSP27 CumulantAll4CompSP27"
 NumberOfTimeSteps=20
 Viscosity="0.001"
 Rho0=1.0
@@ -43,7 +42,7 @@ ySliceForCalculation=0
 ##################################################
 PhiAndNuTest=true
 MinOrderOfAccuracy=1.95
-DataToCalc_PhiAndNu="Vx"
+DataToCalc_PhiAndNu="Vx Vz"
 StartTimeStepCalculation_PhiNu=11
 EndTimeStepCalculation_PhiNu=20
 
@@ -99,10 +98,10 @@ GridPath512="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni512x4x768"
 ##################################################
 # 			File Writing Information			 #
 ##################################################
-WriteVTKFiles=true
+WriteVTKFiles=false
 PathForVTKFileWriting="C:\Users\Timon\Documents\studienarbeitIRMB\Output"
 StartStepFileWriter=0
 
-WriteAnalyResultsToVTK=true
+WriteAnalyResultsToVTK=false
 
 PathLogFile="C:\Users\Timon\Documents\studienarbeitIRMB\logFiles"
\ No newline at end of file
-- 
GitLab