diff --git a/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.cpp b/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.cpp index ddd0cabb062552132e861c576c60439fd2009d69..0c1e474cd3b15cfa6314bedf66dc41756a6fb6f6 100644 --- a/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.cpp +++ b/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.cpp @@ -11,6 +11,7 @@ ToVectorWriter::ToVectorWriter(unsigned int ySliceForCalculation, unsigned int s this->startTimeY2dSliceToVector = startTimeY2dSliceToVector; this->startTimeDataWriter = startTimeDataWriter; this->endTime = endTime; + this->timeStepLength = timeStepLength; } void ToVectorWriter::writeInit(std::shared_ptr<Parameter> para) diff --git a/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.h b/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.h index 3298004fe273c74888f3b4e386bc8d4335981d96..d4626ad5227e1e0d684871558d3d7165cb29d315 100644 --- a/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.h +++ b/targets/tests/NumericalTests/Utilities/DataWriter/ToVectorWriter.h @@ -24,6 +24,7 @@ protected: unsigned int ySliceForCalculation; unsigned int counterTimeSteps; + unsigned int timeStepLength; unsigned int startTimeY2dSliceToVector, startTimeDataWriter; unsigned int endTime; unsigned int maxX, maxY, maxZ; diff --git a/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp b/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp index e5fd2e9c3fe6160c41e31e8fd8d9263c872e16a9..3a10d7833894afb26cbd8f30906b949e2e669f91 100644 --- a/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp +++ b/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp @@ -7,13 +7,11 @@ Y2dSliceToResults::Y2dSliceToResults(std::shared_ptr<SimulationResults> simResults, unsigned int ySliceForCalculation, unsigned int startTimeY2dSliceToVector, unsigned int endTime, unsigned int timeStepLength, bool writeFiles, std::shared_ptr<FileWriter> fileWriter, unsigned int startTimeDataWriter): ToVectorWriter(ySliceForCalculation, startTimeY2dSliceToVector, endTime, timeStepLength, writeFiles, fileWriter, startTimeDataWriter) { this->simResults = simResults; - counterTimeSteps = 0; } void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned int t, int level) { - counterTimeSteps++; - + int timestep = t / timeStepLength; maxX = para->getGridX().at(level); maxY = para->getGridY().at(level); maxZ = para->getGridZ().at(level); @@ -22,6 +20,7 @@ void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned std::vector<double> x(numberNodes), y(numberNodes), z(numberNodes); std::vector<double> vx(numberNodes), vy(numberNodes), vz(numberNodes); std::vector<double> press(numberNodes), rho(numberNodes); + std::vector<unsigned int> levels(numberNodes); for (int posZ = 0; posZ < maxZ - 1; posZ++) { @@ -38,10 +37,10 @@ void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned 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(); + levels.at(posResults) = level; } } - simResults->addTimeStep(counterTimeSteps, t, x, y, z, vx, vy, vz, press, rho); - counterTimeSteps++; + simResults->addTimeStep(timestep, t, levels, x, y, z, vx, vy, vz, press, rho); } int Y2dSliceToResults::CoordPara3DTo1D(int x, int y, int z) diff --git a/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.h b/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.h index be143d9a629485a0756261611a4ed27116990487..c71077bf408777771cb6258972528d598ac6713a 100644 --- a/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.h +++ b/targets/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.h @@ -19,6 +19,5 @@ private: std::shared_ptr<SimulationResults> simResults; int CoordPara3DTo1D(int x, int y, int z); int CoordResults2DTo1D(int x, int z); - int counterTimeSteps; }; #endif \ No newline at end of file diff --git a/targets/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.cpp b/targets/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.cpp index 1c6756c7e1da0aa65abb775507f29fd119102d8c..d2a0646c99c4a66c60fd56bd22c97c4a87c3e7da 100644 --- a/targets/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.cpp +++ b/targets/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.cpp @@ -14,6 +14,7 @@ void AnalyticalResults::init(std::shared_ptr<SimulationResults> simResults) this->x = simResults->getXNodes(); this->y = simResults->getYNodes(); this->z = simResults->getZNodes(); + this->level = simResults->getLevels(); this->vx.resize(numberOfTimeSteps); this->vy.resize(numberOfTimeSteps); diff --git a/targets/tests/NumericalTests/Utilities/Results/Results.h b/targets/tests/NumericalTests/Utilities/Results/Results.h index 9e34de76d483227a244b4ccf07848d78f6a3f216..43983b91ed25f09489ff05858d1e7e8d0cbb0f46 100644 --- a/targets/tests/NumericalTests/Utilities/Results/Results.h +++ b/targets/tests/NumericalTests/Utilities/Results/Results.h @@ -18,6 +18,7 @@ public: virtual std::vector<std::vector<double>> getZNodes() = 0; virtual int getTimeStepLength() = 0; virtual std::vector<unsigned int> getTimeSteps() = 0; + virtual std::vector < std::vector< unsigned int>> getLevels() = 0; private: diff --git a/targets/tests/NumericalTests/Utilities/Results/ResultsImp.cpp b/targets/tests/NumericalTests/Utilities/Results/ResultsImp.cpp index 2846b9c0054e023715fa85f1133215d585410361..d8aabcc29fa13a0385deabfef7b4678f7ff9622e 100644 --- a/targets/tests/NumericalTests/Utilities/Results/ResultsImp.cpp +++ b/targets/tests/NumericalTests/Utilities/Results/ResultsImp.cpp @@ -58,4 +58,9 @@ int ResultsImp::getTimeStepLength() std::vector<unsigned int> ResultsImp::getTimeSteps() { return timeStep; -} \ No newline at end of file +} + +std::vector<std::vector<unsigned int>> ResultsImp::getLevels() +{ + return level; +} diff --git a/targets/tests/NumericalTests/Utilities/Results/ResultsImp.h b/targets/tests/NumericalTests/Utilities/Results/ResultsImp.h index c13c7e28383bab98bd11fccb759970f19e7c1029..0cd41be2985cffd7af995c1525f1e92176fac606 100644 --- a/targets/tests/NumericalTests/Utilities/Results/ResultsImp.h +++ b/targets/tests/NumericalTests/Utilities/Results/ResultsImp.h @@ -18,6 +18,7 @@ public: std::vector<std::vector<double>> getZNodes(); int getTimeStepLength(); std::vector<unsigned int> getTimeSteps(); + std::vector< std::vector< unsigned int> > getLevels(); protected: ResultsImp() {}; @@ -33,6 +34,7 @@ protected: std::vector<std::vector<double>> vx, vy, vz; std::vector<std::vector<double>> press; std::vector<std::vector<double>> rho; + std::vector<std::vector<unsigned int>> level; private: diff --git a/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.cpp b/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.cpp index 21c91358a1194f30eb70b08342e9069e2d7e4568..6e7fafe2345895535631d86c6408eb72bcfec959 100644 --- a/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.cpp +++ b/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.cpp @@ -18,7 +18,7 @@ std::shared_ptr<SimulationResults> SimulationResults::getNewInstance(unsigned in return std::shared_ptr<SimulationResults>(new SimulationResults(lx, ly, lz, timeStepLength)); } -void SimulationResults::addTimeStep(unsigned int timeStep, unsigned int time, std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, std::vector<double> vz, std::vector<double> press, std::vector<double> rho) +void SimulationResults::addTimeStep(unsigned int timeStep, unsigned int time, std::vector<unsigned int> level, std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, std::vector<double> vz, std::vector<double> press, std::vector<double> rho) { this->timeStep.push_back(timeStep); this->time.push_back(time); @@ -30,5 +30,6 @@ void SimulationResults::addTimeStep(unsigned int timeStep, unsigned int time, st this->vz.push_back(vz); this->press.push_back(press); this->rho.push_back(rho); + this->level.push_back(level); numberOfTimeSteps++; } \ No newline at end of file diff --git a/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h b/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h index e9f9cf03db6e40d0b20ceb0e3cc9917d5e903cae..0b48cc89a6c42c50076b6c7a2ac7f3e83c5a29c1 100644 --- a/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h +++ b/targets/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h @@ -8,7 +8,7 @@ class SimulationResults : public ResultsImp { public: static std::shared_ptr<SimulationResults> getNewInstance(unsigned int lx, unsigned int ly, unsigned int lz, unsigned int timeStepLength); - void addTimeStep(unsigned int timeStep, unsigned int time, std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, std::vector<double> vz, std::vector<double> press, std::vector<double> rho); + void addTimeStep(unsigned int timeStep, unsigned int time, std::vector<unsigned int> level, std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, std::vector<double> vz, std::vector<double> press, std::vector<double> rho); private: SimulationResults(unsigned int lx, unsigned int ly, unsigned int lz, unsigned int timeStepLength);