Skip to content
Snippets Groups Projects
Commit 41bd738e authored by Timon Habenicht's avatar Timon Habenicht
Browse files

adds NumericalTestSimulation

parent fcc17b0c
No related branches found
No related tags found
No related merge requests found
Showing
with 43 additions and 43 deletions
#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);
......
......@@ -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
......@@ -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;
......
......@@ -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;
};
......
......@@ -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);
......
......@@ -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;
......
#ifndef NUMERICAL_TEST_SIMULATION_H
#define NUMERICAL_TEST_SIMULATION_H
class NumericalTestSimulation
{
public:
virtual bool getSimulationRun() = 0;
};
#endif
\ No newline at end of file
#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);
......
......@@ -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;
......
......@@ -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
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment