Skip to content
Snippets Groups Projects
Commit 453645d5 authored by Sören Peters's avatar Sören Peters Committed by Sven Marcus
Browse files

Numerical tests compile again

parent 5090cf39
No related branches found
No related tags found
1 merge request!127Numerical tests run again
Showing
with 275 additions and 263 deletions
......@@ -11,7 +11,8 @@
#include "Utilities/LogFileData/LogFileDataImp.h"
#include "Core/Input/Input.h"
// #include "Core/Input/Input.h"
#include <basics/config/ConfigurationFile.h>
#include "Core/StringUtilities/StringUtil.h"
#include "Utilities/AlmostEquals.h"
......@@ -33,33 +34,35 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
{
std::shared_ptr<LogFileDataImp> logFileData = LogFileDataImp::getNewInstance();
std::ifstream stream;
stream.open(filePath.c_str(), std::ios::in);
if (stream.fail()) {
std::cout << "can not open log file!\n";
exit(1);
}
// std::ifstream stream;
// stream.open(filePath.c_str(), std::ios::in);
// if (stream.fail()) {
// std::cout << "can not open log file!\n";
// exit(1);
// }
std::unique_ptr<input::Input> input = input::Input::makeInput(stream, "config");
// std::unique_ptr<input::Input> input = input::Input::makeInput(stream, "config");
auto input = std::make_shared<vf::basics::ConfigurationFile>();
input->load(filePath);
logFileData->setFilePath(filePath);
logFileData->setDate(input->getValue("Date"));
logFileData->setTime(input->getValue("Time"));
logFileData->setGpuDevices(StringUtil::toStringVector(input->getValue("GPU_Devices")));
logFileData->setDate(input->getValue<std::string>("Date"));
logFileData->setTime(input->getValue<std::string>("Time"));
logFileData->setGpuDevices(StringUtil::toStringVector(input->getValue<std::string>("GPU_Devices")));
logFileData->setKernel(input->getValue("Kernel"));
logFileData->setNumberOfTimeSteps(StringUtil::toInt(input->getValue("NumberOfTimeSteps")));
logFileData->setViscosity(StringUtil::toDouble(input->getValue("Viscosity")));
logFileData->setBasisTimeStepLength(StringUtil::toInt(input->getValue("BasisTimeStepLength")));
logFileData->setKernel(input->getValue<std::string>("Kernel"));
logFileData->setNumberOfTimeSteps(StringUtil::toInt(input->getValue<std::string>("NumberOfTimeSteps")));
logFileData->setViscosity(StringUtil::toDouble(input->getValue<std::string>("Viscosity")));
logFileData->setBasisTimeStepLength(StringUtil::toInt(input->getValue<std::string>("BasisTimeStepLength")));
logFileData->setSimName(input->getValue("SimulationName"));
logFileData->setSimName(input->getValue<std::string>("SimulationName"));
std::ostringstream simSigniture;
if (logFileData->getSimName() == "ShearWave") {
std::vector<double> shearWaveLx = StringUtil::toDoubleVector(input->getValue("Lx"));
std::vector<double> shearWaveLx = StringUtil::toDoubleVector(input->getValue<std::string>("Lx"));
logFileData->setBasicGridLengths(shearWaveLx);
std::vector<int> shearWaveL0;
std::vector<double> shearWaveUx;
......@@ -69,9 +72,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
l0 << "l0_" << shearWaveLx.at(i);
ux << "ux_" << shearWaveLx.at(i);
uz << "uz_" << shearWaveLx.at(i);
shearWaveL0.push_back(StringUtil::toInt(input->getValue(l0.str())));
shearWaveUx.push_back(StringUtil::toDouble(input->getValue(ux.str())));
shearWaveUz.push_back(StringUtil::toDouble(input->getValue(uz.str())));
shearWaveL0.push_back(StringUtil::toInt(input->getValue<std::string>(l0.str())));
shearWaveUx.push_back(StringUtil::toDouble(input->getValue<std::string>(ux.str())));
shearWaveUz.push_back(StringUtil::toDouble(input->getValue<std::string>(uz.str())));
}
std::shared_ptr<ShearWaveLogFileDataImp> swLogFileData = ShearWaveLogFileDataImp::getNewInstance();
swLogFileData->setL0(shearWaveL0);
......@@ -82,7 +85,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
logFileData->setBasicSimulation(ShearWave);
}
if (logFileData->getSimName() == "TaylorGreenVortexUx") {
std::vector<double> tgvUxLx = StringUtil::toDoubleVector(input->getValue("Lx"));
std::vector<double> tgvUxLx = StringUtil::toDoubleVector(input->getValue<std::string>("Lx"));
logFileData->setBasicGridLengths(tgvUxLx);
std::vector<int> tgvUxL0;
std::vector<double> tgvUxUx;
......@@ -92,9 +95,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
l0 << "l0_" << tgvUxLx.at(i);
ux << "ux_" << tgvUxLx.at(i);
amplitude << "Amplitude_" << tgvUxLx.at(i);
tgvUxL0.push_back(StringUtil::toInt(input->getValue(l0.str())));
tgvUxUx.push_back(StringUtil::toDouble(input->getValue(ux.str())));
tgvUxAmp.push_back(StringUtil::toDouble(input->getValue(amplitude.str())));
tgvUxL0.push_back(StringUtil::toInt(input->getValue<std::string>(l0.str())));
tgvUxUx.push_back(StringUtil::toDouble(input->getValue<std::string>(ux.str())));
tgvUxAmp.push_back(StringUtil::toDouble(input->getValue<std::string>(amplitude.str())));
}
std::shared_ptr<TaylorGreenVortexUxLogFileDataImp> tgvUxLogFileData = TaylorGreenVortexUxLogFileDataImp::getNewInstance();
tgvUxLogFileData->setL0(tgvUxL0);
......@@ -105,7 +108,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
logFileData->setBasicSimulation(TaylorGreenVortexUx);
}
if (logFileData->getSimName() == "TaylorGreenVortexUz") {
std::vector<double> tgvUzLz = StringUtil::toDoubleVector(input->getValue("Lx"));
std::vector<double> tgvUzLz = StringUtil::toDoubleVector(input->getValue<std::string>("Lx"));
logFileData->setBasicGridLengths(tgvUzLz);
std::vector<int> tgvUzL0;
std::vector<double> tgvUzUz;
......@@ -115,9 +118,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
l0 << "l0_" << tgvUzLz.at(i);
uz << "uz_" << tgvUzLz.at(i);
amplitude << "Amplitude_" << tgvUzLz.at(i);
tgvUzL0.push_back(StringUtil::toInt(input->getValue(l0.str())));
tgvUzUz.push_back(StringUtil::toDouble(input->getValue(uz.str())));
tgvUzAmp.push_back(StringUtil::toDouble(input->getValue(amplitude.str())));
tgvUzL0.push_back(StringUtil::toInt(input->getValue<std::string>(l0.str())));
tgvUzUz.push_back(StringUtil::toDouble(input->getValue<std::string>(uz.str())));
tgvUzAmp.push_back(StringUtil::toDouble(input->getValue<std::string>(amplitude.str())));
}
std::shared_ptr<TaylorGreenVortexUzLogFileDataImp> tgvUzLogFileData = TaylorGreenVortexUzLogFileDataImp::getNewInstance();
tgvUzLogFileData->setL0(tgvUzL0);
......@@ -140,10 +143,10 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
resultsCheckTimeOStringStream << "ResultsCheckTime_" << logFileData->getBasicGridLengths().at(i);
testTimeOStringStream << "TestTime_" << logFileData->getBasicGridLengths().at(i);
analyticalVTKWritingTimeOStringStream << "AnalyticalVTKFileWritingTime_" << logFileData->getBasicGridLengths().at(i);
std::string simTimeString = input->getValue(simTimeOStringStream.str());
std::string resultCheckTimeString = input->getValue(resultsCheckTimeOStringStream.str());
std::string testTimeString = input->getValue(testTimeOStringStream.str());
std::string analyticalVTKWritingTimeString = input->getValue(analyticalVTKWritingTimeOStringStream.str());
std::string simTimeString = input->getValue<std::string>(simTimeOStringStream.str());
std::string resultCheckTimeString = input->getValue<std::string>(resultsCheckTimeOStringStream.str());
std::string testTimeString = input->getValue<std::string>(testTimeOStringStream.str());
std::string analyticalVTKWritingTimeString = input->getValue<std::string>(analyticalVTKWritingTimeOStringStream.str());
simTimeString.erase(simTimeString.end() - 3, simTimeString.end());
resultCheckTimeString.erase(resultCheckTimeString.end() - 3, resultCheckTimeString.end());
testTimeString.erase(testTimeString.end() - 3, testTimeString.end());
......@@ -154,29 +157,29 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
analyticalVTKWritingTime.push_back(StringUtil::toInt(analyticalVTKWritingTimeString));
}
logFileData->setVTKFileWriting(StringUtil::toBool(input->getValue("VTKFileWriting")));
logFileData->setVTKFileWriting(StringUtil::toBool(input->getValue<std::string>("VTKFileWriting")));
logFileData->setSimTime(simTime);
logFileData->setResultCheckTime(resultsCheckTime);
logFileData->setTestTime(testTime);
logFileData->setAnalyticalVTKWritingTime(analyticalVTKWritingTime);
logFileData->setPhiTestRun(StringUtil::toBool(input->getValue("PhiTest")));
logFileData->setNyTestRun(StringUtil::toBool(input->getValue("NyTest")));
logFileData->setL2NormTestRun(StringUtil::toBool(input->getValue("L2NormTest")));
logFileData->setL2NormTestBetweenKernelRun(StringUtil::toBool(input->getValue("L2NormTestBetweenKernel")));
logFileData->setPhiTestRun(StringUtil::toBool(input->getValue<std::string>("PhiTest")));
logFileData->setNyTestRun(StringUtil::toBool(input->getValue<std::string>("NyTest")));
logFileData->setL2NormTestRun(StringUtil::toBool(input->getValue<std::string>("L2NormTest")));
logFileData->setL2NormTestBetweenKernelRun(StringUtil::toBool(input->getValue<std::string>("L2NormTestBetweenKernel")));
if (logFileData->getPhiTestRun()) {
std::vector<std::string> failPhi = StringUtil::toStringVector(input->getValue("FailTests_Phi_PhiTest"));
std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue("FailTests_OOA_PhiTest"));
std::vector<std::string> failPhi = StringUtil::toStringVector(input->getValue<std::string>("FailTests_Phi_PhiTest"));
std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue<std::string>("FailTests_OOA_PhiTest"));
std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue("DataToCalc_PhiTest"));
std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue<std::string>("DataToCalc_PhiTest"));
std::vector<std::shared_ptr<PhiLogFileData> > aPhiLogGroup;
for (int i = 0; i < dataToCalc.size(); i++) {
std::shared_ptr<PhiLogFileDataImp> phiLog = PhiLogFileDataImp::getNewInstance();
phiLog->setBasicGridLengths(logFileData->getBasicGridLengths());
phiLog->setDataToCalc(dataToCalc.at(i));
phiLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue("StartTimeStepCalculation_PhiTest")));
phiLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue("EndTimeStepCalculation_PhiTest")));
phiLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_PhiTest")));
phiLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_PhiTest")));
std::vector<double> phiDiff;
std::vector<std::vector<double> > orderOfAccuracy;
......@@ -190,7 +193,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
}
if (!failData) {
phiDiffString << "PhiDiff_" << logFileData->getBasicGridLengths().at(j) << "_" << dataToCalc.at(i);
phiDiff.push_back(StringUtil::toDouble(input->getValue(phiDiffString.str())));
phiDiff.push_back(StringUtil::toDouble(input->getValue<std::string>(phiDiffString.str())));
}
for (int k = j + 1; k < logFileData->getBasicGridLengths().size(); k++) {
......@@ -206,7 +209,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
phiDiffOOA << "OrderOfAccuracy_PhiDiff_" << phiDiffBasicOOA.str();
aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(j));
aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(k));
aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue(phiDiffOOA.str())));
aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue<std::string>(phiDiffOOA.str())));
}
if (aOrderOfAccuracyGroup.size() > 0)
orderOfAccuracy.push_back(aOrderOfAccuracyGroup);
......@@ -231,17 +234,17 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
if (logFileData->getNyTestRun()) {
std::vector<std::string> failNy = StringUtil::toStringVector(input->getValue("FailTests_Ny_NyTest"));
std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue("FailTests_OOA_NyTest"));
std::vector<std::string> failNy = StringUtil::toStringVector(input->getValue<std::string>("FailTests_Ny_NyTest"));
std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue<std::string>("FailTests_OOA_NyTest"));
std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue("DataToCalc_NyTest"));
std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue<std::string>("DataToCalc_NyTest"));
std::vector<std::shared_ptr<NyLogFileData> > aNyLogGroup;
for (int i = 0; i < dataToCalc.size(); i++) {
std::shared_ptr<NyLogFileDataImp> nyLog = NyLogFileDataImp::getNewInstance();
nyLog->setBasicGridLengths(logFileData->getBasicGridLengths());
nyLog->setDataToCalc(dataToCalc.at(i));
nyLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue("StartTimeStepCalculation_NyTest")));
nyLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue("EndTimeStepCalculation_NyTest")));
nyLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_NyTest")));
nyLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_NyTest")));
std::vector<double> ny, nyDiff;
std::vector<std::vector<double> > orderOfAccuracy;
......@@ -255,9 +258,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
}
if (!failData) {
nyString << "Ny_" << nyBasicString.str();
ny.push_back(StringUtil::toDouble(input->getValue(nyString.str())));
ny.push_back(StringUtil::toDouble(input->getValue<std::string>(nyString.str())));
nyDiffString << "NyDiff_" << logFileData->getBasicGridLengths().at(j) << "_" << dataToCalc.at(i);
nyDiff.push_back(StringUtil::toDouble(input->getValue(nyDiffString.str())));
nyDiff.push_back(StringUtil::toDouble(input->getValue<std::string>(nyDiffString.str())));
}
......@@ -274,7 +277,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
nyDiffOOA << "OrderOfAccuracy_NyDiff_" << nyDiffBasicOOA.str();
aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(j));
aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(k));
aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue(nyDiffOOA.str())));
aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue<std::string>(nyDiffOOA.str())));
}
if (aOrderOfAccuracyGroup.size() > 0)
orderOfAccuracy.push_back(aOrderOfAccuracyGroup);
......@@ -300,17 +303,17 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
if (logFileData->getL2NormTestRun()) {
std::vector<std::shared_ptr<L2NormLogFileData> > l2NormGroup;
std::vector<std::string> dataToCalcL2Norm = StringUtil::toStringVector(input->getValue("DataToCalc_L2Norm"));
std::vector<std::string> normData = StringUtil::toStringVector(input->getValue("NormalizeData_L2Norm"));
std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue("FailTests_L2Norm"));
std::vector<std::string> dataToCalcL2Norm = StringUtil::toStringVector(input->getValue<std::string>("DataToCalc_L2Norm"));
std::vector<std::string> normData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeData_L2Norm"));
std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue<std::string>("FailTests_L2Norm"));
for (int i = 0; i < dataToCalcL2Norm.size(); i++) {
for (int k = 0; k < normData.size(); k++) {
std::shared_ptr<L2NormLogFileDataImp> aL2Norm = L2NormLogFileDataImp::getNewInstance();
aL2Norm->setDataToCalc(dataToCalcL2Norm.at(i));
aL2Norm->setNormalizeData(normData.at(k));
aL2Norm->setBasicGridLengths(logFileData->getBasicGridLengths());
aL2Norm->setBasicTimeStep(StringUtil::toInt(input->getValue("BasicTimeStep_L2Norm")));
aL2Norm->setDivergentTimeStep(StringUtil::toInt(input->getValue("DivergentTimeStep_L2Norm")));
aL2Norm->setBasicTimeStep(StringUtil::toInt(input->getValue<std::string>("BasicTimeStep_L2Norm")));
aL2Norm->setDivergentTimeStep(StringUtil::toInt(input->getValue<std::string>("DivergentTimeStep_L2Norm")));
std::vector<double> l2NormBasicTimeStep;
std::vector<double> l2NormDivergentTimeStep;
......@@ -327,9 +330,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
basicTimeStep << "L2Norm_BasicTimeStep_" << basicString.str();
divergentTimeStep << "L2Norm_DivergentTimeStep_" << basicString.str();
diff << "L2Norm_Diff_" << basicString.str();
l2NormBasicTimeStep.push_back(StringUtil::toDouble(input->getValue(basicTimeStep.str())));
l2NormDivergentTimeStep.push_back(StringUtil::toDouble(input->getValue(divergentTimeStep.str())));
l2NormDiff.push_back(StringUtil::toDouble(input->getValue(diff.str())));
l2NormBasicTimeStep.push_back(StringUtil::toDouble(input->getValue<std::string>(basicTimeStep.str())));
l2NormDivergentTimeStep.push_back(StringUtil::toDouble(input->getValue<std::string>(divergentTimeStep.str())));
l2NormDiff.push_back(StringUtil::toDouble(input->getValue<std::string>(diff.str())));
}
}
if (l2NormBasicTimeStep.size() > 0) {
......@@ -380,10 +383,10 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
if (logFileData->getL2NormTestBetweenKernelRun()) {
std::vector<std::shared_ptr<L2NormBetweenKernelsLogFileData> > l2NormBetweenKernelsData;
std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue("DataToCalculate_L2Norm_BK"));
std::vector<int> timeSteps = StringUtil::toIntVector(input->getValue("TimeSteps_L2Norm_BK"));
std::vector<std::string> normalizeData = StringUtil::toStringVector(input->getValue("NormalizeWith_L2Norm_BK"));
std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue("FailTests_L2Norm_BK"));
std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue<std::string>("DataToCalculate_L2Norm_BK"));
std::vector<int> timeSteps = StringUtil::toIntVector(input->getValue<std::string>("TimeSteps_L2Norm_BK"));
std::vector<std::string> normalizeData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeWith_L2Norm_BK"));
std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue<std::string>("FailTests_L2Norm_BK"));
for (int i = 0; i < dataToCalc.size(); i++) {
......@@ -393,7 +396,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
std::vector<double> l2NormDivergentKernel;
std::vector<double> l2NormBetweenKernels;
std::shared_ptr<L2NormBetweenKernelsLogFileDataImp> aL2NormLogFileData = L2NormBetweenKernelsLogFileDataImp::getNewInstance();
aL2NormLogFileData->setBasicKernel(input->getValue("BasicKernel_L2Norm_BK"));
aL2NormLogFileData->setBasicKernel(input->getValue<std::string>("BasicKernel_L2Norm_BK"));
aL2NormLogFileData->setDivergentKernel(logFileData->getKernel());
aL2NormLogFileData->setDataToCalculate(dataToCalc.at(i));
aL2NormLogFileData->setTimeStep(timeSteps.at(j));
......@@ -415,9 +418,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string
basicKernel << "L2Norm_BasicKernel_" << basicString.str();
divergentKernel << "L2Norm_DivergentKernel_" << basicString.str();
diff << "L2Norm_Between_Kernels_" << basicString.str();
l2NormBasicKernel.push_back(StringUtil::toDouble(input->getValue(basicKernel.str())));
l2NormDivergentKernel.push_back(StringUtil::toDouble(input->getValue(divergentKernel.str())));
l2NormBetweenKernels.push_back(StringUtil::toDouble(input->getValue(diff.str())));
l2NormBasicKernel.push_back(StringUtil::toDouble(input->getValue<std::string>(basicKernel.str())));
l2NormDivergentKernel.push_back(StringUtil::toDouble(input->getValue<std::string>(divergentKernel.str())));
l2NormBetweenKernels.push_back(StringUtil::toDouble(input->getValue<std::string>(diff.str())));
}
}
if (l2NormBasicKernel.size() > 0) {
......
#include "PostProcessingConfigFileReaderImp.h"
#include "Core/Input/Input.h"
// #include "Core/Input/Input.h"
#include <basics/config/ConfigurationFile.h>
#include "Core/StringUtilities/StringUtil.h"
#include "Utilities/PostProcessingConfigData/PostProcessingConfigDataImp.h"
......@@ -15,48 +16,50 @@ std::shared_ptr<PostProcessingConfigFileReader> PostProcessingConfigFileReaderIm
std::shared_ptr<PostProcessingConfigData> PostProcessingConfigFileReaderImp::readConfigFile(std::string filePath)
{
std::ifstream stream;
stream.open(filePath.c_str(), std::ios::in);
if (stream.fail()) {
throw "can not open config file!\n";
exit(1);
}
std::shared_ptr<input::Input> input = input::Input::makeInput(stream, "config");
// std::ifstream stream;
// stream.open(filePath.c_str(), std::ios::in);
// if (stream.fail()) {
// throw "can not open config file!\n";
// exit(1);
// }
// std::shared_ptr<input::Input> input = input::Input::makeInput(stream, "config");
auto input = std::make_shared<vf::basics::ConfigurationFile>();
input->load(filePath);
std::vector<BasicSimulation> simulation;
std::vector<Assistant> assistants;
std::vector<DataCombination> combination;
if(StringUtil::toBool(input->getValue("ShearWave")))
if(StringUtil::toBool(input->getValue<std::string>("ShearWave")))
simulation.push_back(ShearWave);
if (StringUtil::toBool(input->getValue("TaylorGreenVortexUx")))
if (StringUtil::toBool(input->getValue<std::string>("TaylorGreenVortexUx")))
simulation.push_back(TaylorGreenVortexUx);
if (StringUtil::toBool(input->getValue("TaylorGreenVortexUz")))
if (StringUtil::toBool(input->getValue<std::string>("TaylorGreenVortexUz")))
simulation.push_back(TaylorGreenVortexUz);
if (StringUtil::toBool(input->getValue("Phi")))
if (StringUtil::toBool(input->getValue<std::string>("Phi")))
assistants.push_back(Phi);
if (StringUtil::toBool(input->getValue("Ny")))
if (StringUtil::toBool(input->getValue<std::string>("Ny")))
assistants.push_back(Ny);
if (StringUtil::toBool(input->getValue("L2Norm")))
if (StringUtil::toBool(input->getValue<std::string>("L2Norm")))
assistants.push_back(L2Norm);
if (StringUtil::toBool(input->getValue("L2Norm_BetweenKernels")))
if (StringUtil::toBool(input->getValue<std::string>("L2Norm_BetweenKernels")))
assistants.push_back(L2NormBetweenKernels);
if (StringUtil::toBool(input->getValue("TimeOutput")))
if (StringUtil::toBool(input->getValue<std::string>("TimeOutput")))
assistants.push_back(Time);
if (StringUtil::toBool(input->getValue("EqualSimulationsForDifferentKernels")))
if (StringUtil::toBool(input->getValue<std::string>("EqualSimulationsForDifferentKernels")))
combination.push_back(EqualSimulationsForDifferentKernels);
if (StringUtil::toBool(input->getValue("EqualKernelSimulationsForDifferentViscosities")))
if (StringUtil::toBool(input->getValue<std::string>("EqualKernelSimulationsForDifferentViscosities")))
combination.push_back(EqualKernelSimulationsForDifferentViscosities);
std::shared_ptr<PostProcessingConfigDataImp> data = PostProcessingConfigDataImp::getNewInstance();
......@@ -65,8 +68,8 @@ std::shared_ptr<PostProcessingConfigData> PostProcessingConfigFileReaderImp::rea
data->setSimulations(simulation);
data->setDataCombinations(combination);
data->setLogFilesPath(input->getValue("LogFilesPath"));
data->setMathematicaFilePath(input->getValue("MathematicaFilePath"));
data->setLogFilesPath(input->getValue<std::string>("LogFilesPath"));
data->setMathematicaFilePath(input->getValue<std::string>("MathematicaFilePath"));
return data;
}
......
#include "ConfigFileReaderNT.h"
#include "Core/Input/Input.h"
// #include "Core/Input/Input.h"
#include <basics/config/ConfigurationFile.h>
#include "Core/StringUtilities/StringUtil.h"
#include <memory>
#include <fstream>
#include <string>
......@@ -29,34 +31,31 @@ ConfigFileReader::ConfigFileReader(const std::string aFilePath) : myFilePath(aFi
void ConfigFileReader::readConfigFile()
{
configData = std::shared_ptr<ConfigDataStruct>(new ConfigDataStruct);
std::ifstream stream = openConfigFile(myFilePath);
std::shared_ptr<input::Input> input = input::Input::makeInput(stream, "config");
auto input = std::make_shared<vf::basics::ConfigurationFile>();
input->load(myFilePath);
if (!checkConfigFile(input))
exit(1);
configData->viscosity = StringUtil::toDoubleVector(input->getValue("Viscosity"));
configData->viscosity = StringUtil::toDoubleVector(input->getValue<std::string>("Viscosity"));
configData->kernelsToTest = readKernelList(input);
configData->writeAnalyticalToVTK = StringUtil::toBool(input->getValue("WriteAnalyResultsToVTK"));
configData->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation"));
;
configData->logFilePath = pathNumericalTests + input->getValue("FolderLogFile");
configData->writeAnalyticalToVTK = StringUtil::toBool(input->getValue<std::string>("WriteAnalyResultsToVTK"));
configData->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation"));
configData->logFilePath = pathNumericalTests + input->getValue<std::string>("FolderLogFile");
configData->numberOfSimulations = calcNumberOfSimulations(input);
std::shared_ptr<BasicSimulationParameterStruct> basicSimPara = makeBasicSimulationParameter(input);
configData->taylorGreenVortexUxParameter = makeTaylorGreenVortexUxParameter(input, basicSimPara);
configData->taylorGreenVortexUxGridInformation = makeGridInformation(input, "TaylorGreenVortexUx");
;
configData->taylorGreenVortexUzParameter = makeTaylorGreenVortexUzParameter(input, basicSimPara);
configData->taylorGreenVortexUzGridInformation = makeGridInformation(input, "TaylorGreenVortexUz");
;
configData->shearWaveParameter = makeShearWaveParameter(input, basicSimPara);
configData->shearWaveGridInformation = makeGridInformation(input, "ShearWave");
;
configData->phiTestParameter = makePhiTestParameter(input);
configData->nyTestParameter = makeNyTestParameter(input);
......@@ -66,8 +65,6 @@ void ConfigFileReader::readConfigFile()
configData->vectorWriterInfo = makeVectorWriterInformationStruct(input);
configData->logFilePara = makeLogFilePara(input);
stream.close();
}
std::ifstream ConfigFileReader::openConfigFile(const std::string aFilePath)
......@@ -82,19 +79,19 @@ std::ifstream ConfigFileReader::openConfigFile(const std::string aFilePath)
std::shared_ptr<ConfigDataStruct> ConfigFileReader::getConfigData() { return configData; }
bool ConfigFileReader::checkConfigFile(std::shared_ptr<input::Input> input)
bool ConfigFileReader::checkConfigFile(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::vector<double> u0TGVux = StringUtil::toDoubleVector(input->getValue("ux_TGV_Ux"));
std::vector<double> amplitudeTGVux = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Ux"));
std::vector<int> basisTimeStepLengthTGVux = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Ux"));
std::vector<double> u0TGVux = StringUtil::toDoubleVector(input->getValue<std::string>("ux_TGV_Ux"));
std::vector<double> amplitudeTGVux = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Ux"));
std::vector<int> basisTimeStepLengthTGVux = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Ux"));
std::vector<double> v0TGVuz = StringUtil::toDoubleVector(input->getValue("uz_TGV_Uz"));
std::vector<double> amplitudeTGVuz = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Uz"));
std::vector<int> basisTimeStepLengthTGVuz = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Uz"));
std::vector<double> v0TGVuz = StringUtil::toDoubleVector(input->getValue<std::string>("uz_TGV_Uz"));
std::vector<double> amplitudeTGVuz = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Uz"));
std::vector<int> basisTimeStepLengthTGVuz = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Uz"));
std::vector<double> v0SW = StringUtil::toDoubleVector(input->getValue("v0_SW"));
std::vector<double> u0SW = StringUtil::toDoubleVector(input->getValue("u0_SW"));
std::vector<int> basisTimeStepLengthSW = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_SW"));
std::vector<double> v0SW = StringUtil::toDoubleVector(input->getValue<std::string>("v0_SW"));
std::vector<double> u0SW = StringUtil::toDoubleVector(input->getValue<std::string>("u0_SW"));
std::vector<int> basisTimeStepLengthSW = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_SW"));
if (u0TGVux.size() != amplitudeTGVux.size() || u0TGVux.size() != basisTimeStepLengthTGVux.size()) {
std::cout << "Length u0_TGV_U0 is unequal to Lenght Amplitude_TGV_U0 or BasisTimeStepLength_TGV_U0!"
......@@ -115,24 +112,24 @@ bool ConfigFileReader::checkConfigFile(std::shared_ptr<input::Input> input)
}
std::shared_ptr<BasicSimulationParameterStruct>
ConfigFileReader::makeBasicSimulationParameter(std::shared_ptr<input::Input> input)
ConfigFileReader::makeBasicSimulationParameter(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::shared_ptr<BasicSimulationParameterStruct> basicSimPara =
std::shared_ptr<BasicSimulationParameterStruct>(new BasicSimulationParameterStruct);
basicSimPara->numberOfTimeSteps = StringUtil::toInt(input->getValue("NumberOfTimeSteps"));
basicSimPara->devices = StringUtil::toUintVector(input->getValue("Devices"));
basicSimPara->numberOfTimeSteps = StringUtil::toInt(input->getValue<std::string>("NumberOfTimeSteps"));
basicSimPara->devices = StringUtil::toUintVector(input->getValue<std::string>("Devices"));
return basicSimPara;
}
std::vector<std::shared_ptr<TaylorGreenVortexUxParameterStruct>>
ConfigFileReader::makeTaylorGreenVortexUxParameter(std::shared_ptr<input::Input> input,
ConfigFileReader::makeTaylorGreenVortexUxParameter(std::shared_ptr<vf::basics::ConfigurationFile> input,
std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter)
{
std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Ux"));
std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Ux"));
std::vector<double> u0 = StringUtil::toDoubleVector(input->getValue("ux_TGV_Ux"));
int l0 = StringUtil::toInt(input->getValue("l0_TGV_Ux"));
std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Ux"));
std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Ux"));
std::vector<double> u0 = StringUtil::toDoubleVector(input->getValue<std::string>("ux_TGV_Ux"));
int l0 = StringUtil::toInt(input->getValue<std::string>("l0_TGV_Ux"));
basicSimParameter->l0 = l0;
std::vector<std::shared_ptr<TaylorGreenVortexUxParameterStruct>> parameter;
......@@ -145,22 +142,22 @@ ConfigFileReader::makeTaylorGreenVortexUxParameter(std::shared_ptr<input::Input>
aParameter->amplitude = amplitude.at(i);
aParameter->basicTimeStepLength = basisTimeStepLength.at(i);
aParameter->l0 = l0;
aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0"));
aParameter->vtkFilePath = pathNumericalTests + input->getValue("FolderForVTKFileWriting");
aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_TGV_Ux"));
aParameter->rho0 = StringUtil::toDouble(input->getValue<std::string>("Rho0"));
aParameter->vtkFilePath = pathNumericalTests + input->getValue<std::string>("FolderForVTKFileWriting");
aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue<std::string>("DataToCalcTests_TGV_Ux"));
parameter.push_back(aParameter);
}
return parameter;
}
std::vector<std::shared_ptr<TaylorGreenVortexUzParameterStruct>>
ConfigFileReader::makeTaylorGreenVortexUzParameter(std::shared_ptr<input::Input> input,
ConfigFileReader::makeTaylorGreenVortexUzParameter(std::shared_ptr<vf::basics::ConfigurationFile> input,
std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter)
{
std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Uz"));
std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Uz"));
std::vector<double> uz = StringUtil::toDoubleVector(input->getValue("uz_TGV_Uz"));
int l0 = StringUtil::toInt(input->getValue("l0_TGV_Uz"));
std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Uz"));
std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Uz"));
std::vector<double> uz = StringUtil::toDoubleVector(input->getValue<std::string>("uz_TGV_Uz"));
int l0 = StringUtil::toInt(input->getValue<std::string>("l0_TGV_Uz"));
basicSimParameter->l0 = l0;
std::vector<std::shared_ptr<TaylorGreenVortexUzParameterStruct>> parameter;
......@@ -172,21 +169,21 @@ ConfigFileReader::makeTaylorGreenVortexUzParameter(std::shared_ptr<input::Input>
aParameter->amplitude = amplitude.at(i);
aParameter->basicTimeStepLength = basisTimeStepLength.at(i);
aParameter->l0 = l0;
aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0"));
aParameter->vtkFilePath = pathNumericalTests + input->getValue("FolderForVTKFileWriting");
aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_TGV_Uz"));
aParameter->rho0 = StringUtil::toDouble(input->getValue<std::string>("Rho0"));
aParameter->vtkFilePath = pathNumericalTests + input->getValue<std::string>("FolderForVTKFileWriting");
aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue<std::string>("DataToCalcTests_TGV_Uz"));
parameter.push_back(aParameter);
}
return parameter;
}
std::vector<std::shared_ptr<ShearWaveParameterStruct>>
ConfigFileReader::makeShearWaveParameter(std::shared_ptr<input::Input> input,
ConfigFileReader::makeShearWaveParameter(std::shared_ptr<vf::basics::ConfigurationFile> input,
std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter)
{
std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_SW"));
std::vector<double> uz = StringUtil::toDoubleVector(input->getValue("v0_SW"));
std::vector<double> ux = StringUtil::toDoubleVector(input->getValue("u0_SW"));
int l0 = StringUtil::toInt(input->getValue("l0_SW"));
std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_SW"));
std::vector<double> uz = StringUtil::toDoubleVector(input->getValue<std::string>("v0_SW"));
std::vector<double> ux = StringUtil::toDoubleVector(input->getValue<std::string>("u0_SW"));
int l0 = StringUtil::toInt(input->getValue<std::string>("l0_SW"));
basicSimParameter->l0 = l0;
std::vector<std::shared_ptr<ShearWaveParameterStruct>> parameter;
......@@ -198,82 +195,82 @@ ConfigFileReader::makeShearWaveParameter(std::shared_ptr<input::Input> input,
aParameter->ux = ux.at(i);
aParameter->basicTimeStepLength = basisTimeStepLength.at(i);
aParameter->l0 = l0;
aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0"));
aParameter->vtkFilePath = pathNumericalTests + input->getValue("FolderForVTKFileWriting");
aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_SW"));
aParameter->rho0 = StringUtil::toDouble(input->getValue<std::string>("Rho0"));
aParameter->vtkFilePath = pathNumericalTests + input->getValue<std::string>("FolderForVTKFileWriting");
aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue<std::string>("DataToCalcTests_SW"));
parameter.push_back(aParameter);
}
return parameter;
}
std::shared_ptr<NyTestParameterStruct> ConfigFileReader::makeNyTestParameter(std::shared_ptr<input::Input> input)
std::shared_ptr<NyTestParameterStruct> ConfigFileReader::makeNyTestParameter(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::shared_ptr<BasicTestParameterStruct> basicTestParameter =
std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct);
basicTestParameter->runTest = StringUtil::toBool(input->getValue("NyTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation"));
basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("NyTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation"));
std::shared_ptr<NyTestParameterStruct> testParameter =
std::shared_ptr<NyTestParameterStruct>(new NyTestParameterStruct);
testParameter->basicTestParameter = basicTestParameter;
testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue("EndTimeStepCalculation_Ny"));
testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue("MinOrderOfAccuracy_Ny"));
testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue("StartTimeStepCalculation_Ny"));
testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_Ny"));
testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue<std::string>("MinOrderOfAccuracy_Ny"));
testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Ny"));
return testParameter;
}
std::shared_ptr<PhiTestParameterStruct> ConfigFileReader::makePhiTestParameter(std::shared_ptr<input::Input> input)
std::shared_ptr<PhiTestParameterStruct> ConfigFileReader::makePhiTestParameter(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::shared_ptr<BasicTestParameterStruct> basicTestParameter =
std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct);
basicTestParameter->runTest = StringUtil::toBool(input->getValue("PhiTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation"));
basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("PhiTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation"));
std::shared_ptr<PhiTestParameterStruct> testParameter =
std::shared_ptr<PhiTestParameterStruct>(new PhiTestParameterStruct);
testParameter->basicTestParameter = basicTestParameter;
testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue("EndTimeStepCalculation_Phi"));
testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue("MinOrderOfAccuracy_Phi"));
testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue("StartTimeStepCalculation_Phi"));
testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_Phi"));
testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue<std::string>("MinOrderOfAccuracy_Phi"));
testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Phi"));
return testParameter;
}
std::shared_ptr<L2NormTestParameterStruct>
ConfigFileReader::makeL2NormTestParameter(std::shared_ptr<input::Input> input)
ConfigFileReader::makeL2NormTestParameter(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::shared_ptr<BasicTestParameterStruct> basicTestParameter =
std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct);
basicTestParameter->runTest = StringUtil::toBool(input->getValue("L2NormTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation"));
basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("L2NormTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation"));
std::shared_ptr<L2NormTestParameterStruct> testParameter =
std::shared_ptr<L2NormTestParameterStruct>(new L2NormTestParameterStruct);
testParameter->basicTestParameter = basicTestParameter;
testParameter->basicTimeStep = StringUtil::toInt(input->getValue("BasicTimeStep_L2"));
testParameter->divergentTimeStep = StringUtil::toInt(input->getValue("DivergentTimeStep_L2"));
testParameter->normalizeData = StringUtil::toStringVector(input->getValue("NormalizeData_L2Norm"));
testParameter->maxDiff = StringUtil::toDoubleVector(input->getValue("MaxL2NormDiff"));
testParameter->basicTimeStep = StringUtil::toInt(input->getValue<std::string>("BasicTimeStep_L2"));
testParameter->divergentTimeStep = StringUtil::toInt(input->getValue<std::string>("DivergentTimeStep_L2"));
testParameter->normalizeData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeData_L2Norm"));
testParameter->maxDiff = StringUtil::toDoubleVector(input->getValue<std::string>("MaxL2NormDiff"));
return testParameter;
}
std::shared_ptr<L2NormTestBetweenKernelsParameterStruct>
ConfigFileReader::makeL2NormTestBetweenKernelsParameter(std::shared_ptr<input::Input> input)
ConfigFileReader::makeL2NormTestBetweenKernelsParameter(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::shared_ptr<BasicTestParameterStruct> basicTestParameter =
std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct);
basicTestParameter->runTest = StringUtil::toBool(input->getValue("L2NormBetweenKernelsTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation"));
basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("L2NormBetweenKernelsTest"));
basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation"));
std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testParameter =
std::shared_ptr<L2NormTestBetweenKernelsParameterStruct>(new L2NormTestBetweenKernelsParameterStruct);
testParameter->basicTestParameter = basicTestParameter;
testParameter->basicKernel = input->getValue("BasicKernel_L2NormBetweenKernels");
testParameter->basicKernel = input->getValue<std::string>("BasicKernel_L2NormBetweenKernels");
testParameter->kernelsToTest = readKernelList(input);
testParameter->timeSteps = StringUtil::toIntVector(input->getValue("Timesteps_L2NormBetweenKernels"));
testParameter->normalizeData = StringUtil::toStringVector(input->getValue("NormalizeData_L2Norm"));
testParameter->timeSteps = StringUtil::toIntVector(input->getValue<std::string>("Timesteps_L2NormBetweenKernels"));
testParameter->normalizeData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeData_L2Norm"));
bool correct = false;
for (int i = 0; i < testParameter->normalizeData.size(); i++)
......@@ -292,7 +289,7 @@ ConfigFileReader::makeL2NormTestBetweenKernelsParameter(std::shared_ptr<input::I
}
std::vector<std::shared_ptr<GridInformationStruct>>
ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std::string simName)
ConfigFileReader::makeGridInformation(std::shared_ptr<vf::basics::ConfigurationFile> input, std::string simName)
{
int number = 32;
std::vector<std::string> valueNames;
......@@ -314,10 +311,10 @@ ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std::
double nextNumber = 32.0;
for (int i = 0; i < valueNames.size(); i++) {
if (StringUtil::toBool(input->getValue(valueNames.at(i)))) {
if (StringUtil::toBool(input->getValue<std::string>(valueNames.at(i)))) {
lx.push_back(nextNumber);
lz.push_back(nextNumber * 3.0 / 2.0);
gridPath.push_back(pathNumericalTests + input->getValue(gridPaths.at(i)));
gridPath.push_back(pathNumericalTests + input->getValue<std::string>(gridPaths.at(i)));
nextNumber *= 2;
}
}
......@@ -326,7 +323,7 @@ ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std::
for (int i = 0; i < lx.size(); i++) {
std::shared_ptr<GridInformationStruct> aGridInformation =
std::shared_ptr<GridInformationStruct>(new GridInformationStruct);
aGridInformation->numberOfGridLevels = StringUtil::toInt(input->getValue("NumberOfGridLevels"));
aGridInformation->numberOfGridLevels = StringUtil::toInt(input->getValue<std::string>("NumberOfGridLevels"));
aGridInformation->maxLevel = aGridInformation->numberOfGridLevels - 1;
aGridInformation->gridPath = gridPath.at(i);
aGridInformation->lx = lx.at(i);
......@@ -337,44 +334,44 @@ ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std::
}
std::shared_ptr<VectorWriterInformationStruct>
ConfigFileReader::makeVectorWriterInformationStruct(std::shared_ptr<input::Input> input)
ConfigFileReader::makeVectorWriterInformationStruct(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::shared_ptr<VectorWriterInformationStruct> vectorWriter =
std::shared_ptr<VectorWriterInformationStruct>(new VectorWriterInformationStruct);
vectorWriter->startTimeVectorWriter = calcStartStepForToVectorWriter(input);
vectorWriter->startTimeVTKDataWriter = StringUtil::toInt(input->getValue("StartStepFileWriter"));
vectorWriter->writeVTKFiles = StringUtil::toBool(input->getValue("WriteVTKFiles"));
vectorWriter->startTimeVTKDataWriter = StringUtil::toInt(input->getValue<std::string>("StartStepFileWriter"));
vectorWriter->writeVTKFiles = StringUtil::toBool(input->getValue<std::string>("WriteVTKFiles"));
return vectorWriter;
}
std::shared_ptr<LogFileParameterStruct> ConfigFileReader::makeLogFilePara(std::shared_ptr<input::Input> input)
std::shared_ptr<LogFileParameterStruct> ConfigFileReader::makeLogFilePara(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::shared_ptr<LogFileParameterStruct> logFilePara =
std::shared_ptr<LogFileParameterStruct>(new LogFileParameterStruct);
logFilePara->devices = StringUtil::toIntVector(input->getValue("Devices"));
logFilePara->numberOfTimeSteps = StringUtil::toInt(input->getValue("NumberOfTimeSteps"));
logFilePara->writeAnalyticalToVTK = StringUtil::toBool(input->getValue("WriteAnalyResultsToVTK"));
logFilePara->devices = StringUtil::toIntVector(input->getValue<std::string>("Devices"));
logFilePara->numberOfTimeSteps = StringUtil::toInt(input->getValue<std::string>("NumberOfTimeSteps"));
logFilePara->writeAnalyticalToVTK = StringUtil::toBool(input->getValue<std::string>("WriteAnalyResultsToVTK"));
return logFilePara;
}
std::vector<std::string> ConfigFileReader::readKernelList(std::shared_ptr<input::Input> input)
std::vector<std::string> ConfigFileReader::readKernelList(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
if (StringUtil::toBool(input->getValue("L2NormBetweenKernelsTest"))) {
std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue("KernelsToTest"));
std::string beginnKernel = input->getValue("BasicKernel_L2NormBetweenKernels");
if (StringUtil::toBool(input->getValue<std::string>("L2NormBetweenKernelsTest"))) {
std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue<std::string>("KernelsToTest"));
std::string beginKernel = input->getValue<std::string>("BasicKernel_L2NormBetweenKernels");
bool basicKernelInKernelList = false;
for (int i = 0; i < kernelList.size(); i++) {
if (kernelList.at(i) == beginnKernel)
if (kernelList.at(i) == beginKernel)
basicKernelInKernelList = true;
}
if (!basicKernelInKernelList)
kernelList.push_back(beginnKernel);
kernelList.push_back(beginKernel);
std::vector<std::string> kernelNames = kernelList;
while (kernelNames.at(0) != beginnKernel) {
while (kernelNames.at(0) != beginKernel) {
kernelNames.push_back(kernelNames.at(0));
std::vector<std::string>::iterator it = kernelNames.begin();
kernelNames.erase(it);
......@@ -384,7 +381,7 @@ std::vector<std::string> ConfigFileReader::readKernelList(std::shared_ptr<input:
kernels.push_back(kernelNames.at(i));
return kernels;
} else {
std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue("KernelsToTest"));
std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue<std::string>("KernelsToTest"));
std::vector<std::string> kernels;
for (int i = 0; i < kernelList.size(); i++)
kernels.push_back(kernelList.at(i));
......@@ -393,42 +390,42 @@ std::vector<std::string> ConfigFileReader::readKernelList(std::shared_ptr<input:
}
}
unsigned int ConfigFileReader::calcStartStepForToVectorWriter(std::shared_ptr<input::Input> input)
unsigned int ConfigFileReader::calcStartStepForToVectorWriter(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
std::vector<unsigned int> startStepsTests;
startStepsTests.push_back(StringUtil::toInt(input->getValue("BasicTimeStep_L2")));
startStepsTests.push_back(StringUtil::toInt(input->getValue("StartTimeStepCalculation_Ny")));
startStepsTests.push_back(StringUtil::toInt(input->getValue("StartTimeStepCalculation_Phi")));
startStepsTests.push_back(StringUtil::toInt(input->getValue<std::string>("BasicTimeStep_L2")));
startStepsTests.push_back(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Ny")));
startStepsTests.push_back(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Phi")));
std::sort(startStepsTests.begin(), startStepsTests.end());
return startStepsTests.at(0);
}
int ConfigFileReader::calcNumberOfSimulations(std::shared_ptr<input::Input> input)
int ConfigFileReader::calcNumberOfSimulations(std::shared_ptr<vf::basics::ConfigurationFile> input)
{
int counter = 0;
int tgvCounterU0 = calcNumberOfSimulationGroup(input, "TaylorGreenVortexUx");
tgvCounterU0 *= int(StringUtil::toDoubleVector(input->getValue("ux_TGV_Ux")).size());
tgvCounterU0 *= int(StringUtil::toDoubleVector(input->getValue<std::string>("ux_TGV_Ux")).size());
counter += tgvCounterU0;
int tgvCounterV0 = calcNumberOfSimulationGroup(input, "TaylorGreenVortexUz");
;
tgvCounterV0 *= int(StringUtil::toDoubleVector(input->getValue("uz_TGV_Uz")).size());
tgvCounterV0 *= int(StringUtil::toDoubleVector(input->getValue<std::string>("uz_TGV_Uz")).size());
counter += tgvCounterV0;
int swCounter = calcNumberOfSimulationGroup(input, "ShearWave");
;
swCounter *= int(StringUtil::toDoubleVector(input->getValue("u0_SW")).size());
swCounter *= int(StringUtil::toDoubleVector(input->getValue<std::string>("u0_SW")).size());
counter += swCounter;
counter *= int(StringUtil::toDoubleVector(input->getValue("Viscosity")).size());
counter *= int(StringUtil::toDoubleVector(input->getValue<std::string>("Viscosity")).size());
counter *= int(configData->kernelsToTest.size());
return counter;
}
int ConfigFileReader::calcNumberOfSimulationGroup(std::shared_ptr<input::Input> input, std::string simName)
int ConfigFileReader::calcNumberOfSimulationGroup(std::shared_ptr<vf::basics::ConfigurationFile> input, std::string simName)
{
int counter = 0;
int number = 32;
......@@ -440,7 +437,7 @@ int ConfigFileReader::calcNumberOfSimulationGroup(std::shared_ptr<input::Input>
number *= 2;
}
for (int i = 0; i < valueNames.size(); i++) {
if (StringUtil::toBool(input->getValue(valueNames.at(i))))
if (StringUtil::toBool(input->getValue<std::string>(valueNames.at(i))))
counter++;
}
return counter;
......
#ifndef CONFIG_FILE_READER_H
#define CONFIG_FILE_READER_H
#include "Core/Input/Input.h"
// #include "Core/Input/Input.h"
#include "Utilities/Structs/ConfigDataStruct.h"
#include <memory>
#include <string>
#include <vector>
namespace vf::basics
{
class ConfigurationFile;
}
class ConfigFileReader
{
public:
......@@ -20,36 +25,36 @@ private:
ConfigFileReader(const std::string aFilePath);
std::ifstream openConfigFile(const std::string aFilePath);
bool checkConfigFile(std::shared_ptr<input::Input> input);
std::vector<std::string> readKernelList(std::shared_ptr<input::Input> input);
bool checkConfigFile(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::vector<std::string> readKernelList(std::shared_ptr<vf::basics::ConfigurationFile> input);
int calcNumberOfSimulations(std::shared_ptr<input::Input> input);
int calcNumberOfSimulationGroup(std::shared_ptr<input::Input> input, std::string simName);
unsigned int calcStartStepForToVectorWriter(std::shared_ptr<input::Input> input);
int calcNumberOfSimulations(std::shared_ptr<vf::basics::ConfigurationFile> input);
int calcNumberOfSimulationGroup(std::shared_ptr<vf::basics::ConfigurationFile> input, std::string simName);
unsigned int calcStartStepForToVectorWriter(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::vector<std::shared_ptr<TaylorGreenVortexUxParameterStruct>>
makeTaylorGreenVortexUxParameter(std::shared_ptr<input::Input> input,
makeTaylorGreenVortexUxParameter(std::shared_ptr<vf::basics::ConfigurationFile> input,
std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter);
std::vector<std::shared_ptr<TaylorGreenVortexUzParameterStruct>>
makeTaylorGreenVortexUzParameter(std::shared_ptr<input::Input> input,
makeTaylorGreenVortexUzParameter(std::shared_ptr<vf::basics::ConfigurationFile> input,
std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter);
std::vector<std::shared_ptr<ShearWaveParameterStruct>>
makeShearWaveParameter(std::shared_ptr<input::Input> input,
makeShearWaveParameter(std::shared_ptr<vf::basics::ConfigurationFile> input,
std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter);
std::shared_ptr<NyTestParameterStruct> makeNyTestParameter(std::shared_ptr<input::Input> input);
std::shared_ptr<PhiTestParameterStruct> makePhiTestParameter(std::shared_ptr<input::Input> input);
std::shared_ptr<L2NormTestParameterStruct> makeL2NormTestParameter(std::shared_ptr<input::Input> input);
std::shared_ptr<NyTestParameterStruct> makeNyTestParameter(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::shared_ptr<PhiTestParameterStruct> makePhiTestParameter(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::shared_ptr<L2NormTestParameterStruct> makeL2NormTestParameter(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::shared_ptr<L2NormTestBetweenKernelsParameterStruct>
makeL2NormTestBetweenKernelsParameter(std::shared_ptr<input::Input> input);
makeL2NormTestBetweenKernelsParameter(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::shared_ptr<BasicSimulationParameterStruct> makeBasicSimulationParameter(std::shared_ptr<input::Input> input);
std::vector<std::shared_ptr<GridInformationStruct>> makeGridInformation(std::shared_ptr<input::Input> input,
std::shared_ptr<BasicSimulationParameterStruct> makeBasicSimulationParameter(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::vector<std::shared_ptr<GridInformationStruct>> makeGridInformation(std::shared_ptr<vf::basics::ConfigurationFile> input,
std::string simName);
std::shared_ptr<VectorWriterInformationStruct>
makeVectorWriterInformationStruct(std::shared_ptr<input::Input> input);
std::shared_ptr<LogFileParameterStruct> makeLogFilePara(std::shared_ptr<input::Input> input);
makeVectorWriterInformationStruct(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::shared_ptr<LogFileParameterStruct> makeLogFilePara(std::shared_ptr<vf::basics::ConfigurationFile> input);
std::string pathNumericalTests;
......
......@@ -38,7 +38,7 @@ void AnalyticalResults2DToVTKWriterImp::writeAnalyticalResult(std::shared_ptr<Pa
for (int level = para->getCoarse(); level <= para->getFine(); level++) {
#pragma omp parallel for
for (int timeStep = 0; timeStep < analyticalResult->getNumberOfTimeSteps(); timeStep++) {
const unsigned int numberOfParts = para->getParH(level)->size_Mat_SP / para->getlimitOfNodesForVTK() + 1;
const unsigned int numberOfParts = para->getParH(level)->size_Mat / para->getlimitOfNodesForVTK() + 1;
std::vector<std::string> fname;
unsigned int time = analyticalResult->getTimeSteps().at(timeStep)*analyticalResult->getTimeStepLength();
for (int j = 1; j <= numberOfParts; j++) {
......@@ -86,8 +86,8 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter>
std::vector<double> vz = analyticalResult->getVz()[timeStep];
for (unsigned int part = 0; part < fname.size(); part++){
if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP)
sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK());
if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat)
sizeOfNodes = para->getParH(level)->size_Mat - (part * para->getlimitOfNodesForVTK());
else
sizeOfNodes = para->getlimitOfNodesForVTK();
......@@ -106,12 +106,12 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter>
//////////////////////////////////////////////////////////////////////////
for (unsigned int pos = startpos; pos < endpos; pos++)
{
if (para->getParH(level)->geoSP[pos] == GEO_FLUID)
if (para->getParH(level)->geo[pos] == GEO_FLUID)
{
//////////////////////////////////////////////////////////////////////////
double x1 = para->getParH(level)->coordX_SP[pos];
double x2 = para->getParH(level)->coordY_SP[pos];
double x3 = para->getParH(level)->coordZ_SP[pos];
double x1 = para->getParH(level)->coordinateX[pos];
double x2 = para->getParH(level)->coordinateY[pos];
double x3 = para->getParH(level)->coordinateZ[pos];
//////////////////////////////////////////////////////////////////////////
number1 = pos;
dn1 = pos - startpos;
......@@ -125,23 +125,23 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter>
nodedata[2][dn1] = vx[numberInResults];
nodedata[3][dn1] = vy[numberInResults];
nodedata[4][dn1] = vz[numberInResults];
nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos];
nodedata[5][dn1] = (double)para->getParH(level)->geo[pos];
//////////////////////////////////////////////////////////////////////////
number2 = para->getParH(level)->neighborX_SP[number1];
number3 = para->getParH(level)->neighborY_SP[number2];
number4 = para->getParH(level)->neighborY_SP[number1];
number5 = para->getParH(level)->neighborZ_SP[number1];
number6 = para->getParH(level)->neighborZ_SP[number2];
number7 = para->getParH(level)->neighborZ_SP[number3];
number8 = para->getParH(level)->neighborZ_SP[number4];
number2 = para->getParH(level)->neighborX[number1];
number3 = para->getParH(level)->neighborY[number2];
number4 = para->getParH(level)->neighborY[number1];
number5 = para->getParH(level)->neighborZ[number1];
number6 = para->getParH(level)->neighborZ[number2];
number7 = para->getParH(level)->neighborZ[number3];
number8 = para->getParH(level)->neighborZ[number4];
//////////////////////////////////////////////////////////////////////////
if (para->getParH(level)->geoSP[number2] != GEO_FLUID ||
para->getParH(level)->geoSP[number3] != GEO_FLUID ||
para->getParH(level)->geoSP[number4] != GEO_FLUID ||
para->getParH(level)->geoSP[number5] != GEO_FLUID ||
para->getParH(level)->geoSP[number6] != GEO_FLUID ||
para->getParH(level)->geoSP[number7] != GEO_FLUID ||
para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsAreFluid = false;
if (para->getParH(level)->geo[number2] != GEO_FLUID ||
para->getParH(level)->geo[number3] != GEO_FLUID ||
para->getParH(level)->geo[number4] != GEO_FLUID ||
para->getParH(level)->geo[number5] != GEO_FLUID ||
para->getParH(level)->geo[number6] != GEO_FLUID ||
para->getParH(level)->geo[number7] != GEO_FLUID ||
para->getParH(level)->geo[number8] != GEO_FLUID) neighborsAreFluid = false;
//////////////////////////////////////////////////////////////////////////
if (number2 > endpos ||
number3 > endpos ||
......
......@@ -41,14 +41,14 @@ void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned
int posResults = CoordResults2DTo1D(posX, posZ);
int posPara = CoordPara3DTo1D(posX, ySliceForCalculation, posZ);
x.at(posResults) = (double)para->getParH(level)->coordX_SP[posPara] - (double)1.0;
y.at(posResults) = (double)para->getParH(level)->coordY_SP[posPara] - (double)1.0;
z.at(posResults) = (double)para->getParH(level)->coordZ_SP[posPara] - (double)1.0;
vx.at(posResults) = (double)para->getParH(level)->vx_SP[posPara] * (double)para->getVelocityRatio();
vy.at(posResults) = (double)para->getParH(level)->vy_SP[posPara] * (double)para->getVelocityRatio();
vz.at(posResults) = (double)para->getParH(level)->vz_SP[posPara] * (double)para->getVelocityRatio();
press.at(posResults) = (double)para->getParH(level)->press_SP[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio();
rho.at(posResults) = (double)para->getParH(level)->rho_SP[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio();
x.at(posResults) = (double)para->getParH(level)->coordinateX[posPara] - (double)1.0;
y.at(posResults) = (double)para->getParH(level)->coordinateY[posPara] - (double)1.0;
z.at(posResults) = (double)para->getParH(level)->coordinateZ[posPara] - (double)1.0;
vx.at(posResults) = (double)para->getParH(level)->velocityX[posPara] * (double)para->getVelocityRatio();
vy.at(posResults) = (double)para->getParH(level)->velocityY[posPara] * (double)para->getVelocityRatio();
vz.at(posResults) = (double)para->getParH(level)->velocityZ[posPara] * (double)para->getVelocityRatio();
press.at(posResults) = (double)para->getParH(level)->pressure[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio();
rho.at(posResults) = (double)para->getParH(level)->rho[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio();
levels.at(posResults) = level;
}
}
......
......@@ -16,15 +16,18 @@ void InitialConditionImp::init(const int level)
real InitialConditionImp::getXCoord(int i, int level)
{
return (real)(para->getParH(level)->coordX_SP[i] - 1.0);
return para->getParH(level)->coordinateX[i] - 1.0;
// return (real)(para->getParH(level)->coordX_SP[i] - 1.0);
}
real InitialConditionImp::getYCoord(int i, int level)
{
return (real)(para->getParH(level)->coordY_SP[i] - 1.0);
return para->getParH(level)->coordinateY[i] - 1.0;
// return (real)(para->getParH(level)->coordY_SP[i] - 1.0);
}
real InitialConditionImp::getZCoord(int i, int level)
{
return (real)(para->getParH(level)->coordZ_SP[i] - 1.0);
return para->getParH(level)->coordinateZ[i] - 1.0;
// return (real)(para->getParH(level)->coordZ_SP[i] - 1.0);
}
\ No newline at end of file
......@@ -17,11 +17,11 @@ void NumericalTestGridReader::setInitalNodeValues(const int numberOfNodes, const
{
initialCondition->init(level);
for (int j = 0; j <= numberOfNodes; j++){
para->getParH(level)->vx_SP[j] = initialCondition->getInitVX(j, level);
para->getParH(level)->vy_SP[j] = initialCondition->getInitVY(j, level);
para->getParH(level)->vz_SP[j] = initialCondition->getInitVZ(j, level);
para->getParH(level)->rho_SP[j] = initialCondition->getInitROH(j, level);
para->getParH(level)->press_SP[j] = initialCondition->getInitPRESS(j, level);
para->getParH(level)->velocityX[j] = initialCondition->getInitVX(j, level);
para->getParH(level)->velocityY[j] = initialCondition->getInitVY(j, level);
para->getParH(level)->velocityZ[j] = initialCondition->getInitVZ(j, level);
para->getParH(level)->rho[j] = initialCondition->getInitROH(j, level);
para->getParH(level)->pressure[j] = initialCondition->getInitPRESS(j, level);
}
}
......
......@@ -4,23 +4,26 @@
#include "Utilities/Time/TimeTracking.h"
#include "VirtualFluids_GPU/LBM/Simulation.h"
#include "VirtualFluids_GPU/Communication/Communicator.h"
#include "VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h"
#include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactory.h"
#include <sstream>
void VirtualFluidSimulationImp::run()
{
numericalTestSuite->makeSimulationHeadOutput();
Simulation sim;
sim.setFactories(kernelFactory, preProcessorFactory);
sim.init(para, grid, dataWriter, cudaManager);
auto sim = Simulation(para, cudaManager, vf::gpu::Communicator::getInstance(), *grid.get(), new BoundaryConditionFactory());
// These are created by the Simulation itself
// sim.setFactories(kernelFactory, preProcessorFactory);
// sim.init(para, grid, dataWriter, cudaManager);
timeTracking->setSimulationStartTime();
sim.run();
timeTracking->setSimulationEndTime();
numericalTestSuite->startPostProcessing();
sim.free();
}
void VirtualFluidSimulationImp::setParameter(std::shared_ptr<Parameter> para)
......
......@@ -24,11 +24,10 @@ VirtualFluidSimulationFactoryImp::VirtualFluidSimulationFactoryImp()
std::shared_ptr<Parameter> VirtualFluidSimulationFactoryImp::makeParameter(std::shared_ptr<SimulationParameter> simPara)
{
std::shared_ptr<Parameter> para = Parameter::make();
auto para = std::make_shared<Parameter>(1, 0);
para->setMaxDev(simPara->getDevices().size());
para->setDevices(simPara->getDevices());
para->setNumprocs(1);
std::string _prefix = "cells";
std::string gridPath = simPara->getGridPath() + "/";
......@@ -102,7 +101,8 @@ std::shared_ptr<Parameter> VirtualFluidSimulationFactoryImp::makeParameter(std::
para->setDistY(dist);
para->setDistZ(dist);
para->setNeedInterface(std::vector<bool>{true, true, true, true, true, true});
// TODO: Find out if we still need this
// para->setNeedInterface(std::vector<bool>{true, true, true, true, true, true});
para->setMainKernel(simPara->getKernelConfiguration()->getMainKernel());
para->setMultiKernelOn(simPara->getKernelConfiguration()->getMultiKernelOn());
......@@ -114,14 +114,12 @@ std::shared_ptr<Parameter> VirtualFluidSimulationFactoryImp::makeParameter(std::
std::shared_ptr<NumericalTestGridReader> VirtualFluidSimulationFactoryImp::makeGridReader(std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager)
{
std::shared_ptr<NumericalTestGridReader> grid = NumericalTestGridReader::getNewInstance(para, initialCondition, cudaManager);
return grid;
return NumericalTestGridReader::getNewInstance(para, initialCondition, cudaManager);
}
std::shared_ptr<CudaMemoryManager> VirtualFluidSimulationFactoryImp::makeCudaMemoryManager(std::shared_ptr<Parameter> para)
{
std::shared_ptr<CudaMemoryManager> cudaManager = CudaMemoryManager::make(para);
return cudaManager;
return std::make_shared<CudaMemoryManager>(para);
}
void VirtualFluidSimulationFactoryImp::initInitialConditions(std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<Parameter> para)
......@@ -133,10 +131,10 @@ std::vector<std::shared_ptr<VirtualFluidSimulation> > VirtualFluidSimulationFact
{
std::vector<std::shared_ptr<VirtualFluidSimulation> > vfSimulations;
std::shared_ptr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance();
std::shared_ptr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance();
auto kernelFactory = std::make_shared<KernelFactoryImp>();
auto preProcessorFactory = std::make_shared<PreProcessorFactoryImp>();
for (int i = 0; i < testSim.size(); i++) {
for (size_t i = 0; i < testSim.size(); i++) {
std::shared_ptr<VirtualFluidSimulationImp> vfSim = VirtualFluidSimulationImp::getNewInstance();
std::shared_ptr<Parameter> para = makeParameter(testSim.at(i)->getSimulationParameter());
......
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