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

adds level to Results

parent a93b5719
No related branches found
No related tags found
No related merge requests found
Showing
with 19 additions and 9 deletions
...@@ -11,6 +11,7 @@ ToVectorWriter::ToVectorWriter(unsigned int ySliceForCalculation, unsigned int s ...@@ -11,6 +11,7 @@ ToVectorWriter::ToVectorWriter(unsigned int ySliceForCalculation, unsigned int s
this->startTimeY2dSliceToVector = startTimeY2dSliceToVector; this->startTimeY2dSliceToVector = startTimeY2dSliceToVector;
this->startTimeDataWriter = startTimeDataWriter; this->startTimeDataWriter = startTimeDataWriter;
this->endTime = endTime; this->endTime = endTime;
this->timeStepLength = timeStepLength;
} }
void ToVectorWriter::writeInit(std::shared_ptr<Parameter> para) void ToVectorWriter::writeInit(std::shared_ptr<Parameter> para)
......
...@@ -24,6 +24,7 @@ protected: ...@@ -24,6 +24,7 @@ protected:
unsigned int ySliceForCalculation; unsigned int ySliceForCalculation;
unsigned int counterTimeSteps; unsigned int counterTimeSteps;
unsigned int timeStepLength;
unsigned int startTimeY2dSliceToVector, startTimeDataWriter; unsigned int startTimeY2dSliceToVector, startTimeDataWriter;
unsigned int endTime; unsigned int endTime;
unsigned int maxX, maxY, maxZ; unsigned int maxX, maxY, maxZ;
......
...@@ -7,13 +7,11 @@ ...@@ -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) 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; this->simResults = simResults;
counterTimeSteps = 0;
} }
void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned int t, int level) void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned int t, int level)
{ {
counterTimeSteps++; int timestep = t / timeStepLength;
maxX = para->getGridX().at(level); maxX = para->getGridX().at(level);
maxY = para->getGridY().at(level); maxY = para->getGridY().at(level);
maxZ = para->getGridZ().at(level); maxZ = para->getGridZ().at(level);
...@@ -22,6 +20,7 @@ void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned ...@@ -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> x(numberNodes), y(numberNodes), z(numberNodes);
std::vector<double> vx(numberNodes), vy(numberNodes), vz(numberNodes); std::vector<double> vx(numberNodes), vy(numberNodes), vz(numberNodes);
std::vector<double> press(numberNodes), rho(numberNodes); std::vector<double> press(numberNodes), rho(numberNodes);
std::vector<unsigned int> levels(numberNodes);
for (int posZ = 0; posZ < maxZ - 1; posZ++) for (int posZ = 0; posZ < maxZ - 1; posZ++)
{ {
...@@ -38,10 +37,10 @@ void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned ...@@ -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(); 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(); 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(); 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); simResults->addTimeStep(timestep, t, levels, x, y, z, vx, vy, vz, press, rho);
counterTimeSteps++;
} }
int Y2dSliceToResults::CoordPara3DTo1D(int x, int y, int z) int Y2dSliceToResults::CoordPara3DTo1D(int x, int y, int z)
......
...@@ -19,6 +19,5 @@ private: ...@@ -19,6 +19,5 @@ private:
std::shared_ptr<SimulationResults> simResults; std::shared_ptr<SimulationResults> simResults;
int CoordPara3DTo1D(int x, int y, int z); int CoordPara3DTo1D(int x, int y, int z);
int CoordResults2DTo1D(int x, int z); int CoordResults2DTo1D(int x, int z);
int counterTimeSteps;
}; };
#endif #endif
\ No newline at end of file
...@@ -14,6 +14,7 @@ void AnalyticalResults::init(std::shared_ptr<SimulationResults> simResults) ...@@ -14,6 +14,7 @@ void AnalyticalResults::init(std::shared_ptr<SimulationResults> simResults)
this->x = simResults->getXNodes(); this->x = simResults->getXNodes();
this->y = simResults->getYNodes(); this->y = simResults->getYNodes();
this->z = simResults->getZNodes(); this->z = simResults->getZNodes();
this->level = simResults->getLevels();
this->vx.resize(numberOfTimeSteps); this->vx.resize(numberOfTimeSteps);
this->vy.resize(numberOfTimeSteps); this->vy.resize(numberOfTimeSteps);
......
...@@ -18,6 +18,7 @@ public: ...@@ -18,6 +18,7 @@ public:
virtual std::vector<std::vector<double>> getZNodes() = 0; virtual std::vector<std::vector<double>> getZNodes() = 0;
virtual int getTimeStepLength() = 0; virtual int getTimeStepLength() = 0;
virtual std::vector<unsigned int> getTimeSteps() = 0; virtual std::vector<unsigned int> getTimeSteps() = 0;
virtual std::vector < std::vector< unsigned int>> getLevels() = 0;
private: private:
......
...@@ -58,4 +58,9 @@ int ResultsImp::getTimeStepLength() ...@@ -58,4 +58,9 @@ int ResultsImp::getTimeStepLength()
std::vector<unsigned int> ResultsImp::getTimeSteps() std::vector<unsigned int> ResultsImp::getTimeSteps()
{ {
return timeStep; return timeStep;
} }
\ No newline at end of file
std::vector<std::vector<unsigned int>> ResultsImp::getLevels()
{
return level;
}
...@@ -18,6 +18,7 @@ public: ...@@ -18,6 +18,7 @@ public:
std::vector<std::vector<double>> getZNodes(); std::vector<std::vector<double>> getZNodes();
int getTimeStepLength(); int getTimeStepLength();
std::vector<unsigned int> getTimeSteps(); std::vector<unsigned int> getTimeSteps();
std::vector< std::vector< unsigned int> > getLevels();
protected: protected:
ResultsImp() {}; ResultsImp() {};
...@@ -33,6 +34,7 @@ protected: ...@@ -33,6 +34,7 @@ protected:
std::vector<std::vector<double>> vx, vy, vz; std::vector<std::vector<double>> vx, vy, vz;
std::vector<std::vector<double>> press; std::vector<std::vector<double>> press;
std::vector<std::vector<double>> rho; std::vector<std::vector<double>> rho;
std::vector<std::vector<unsigned int>> level;
private: private:
......
...@@ -18,7 +18,7 @@ std::shared_ptr<SimulationResults> SimulationResults::getNewInstance(unsigned in ...@@ -18,7 +18,7 @@ std::shared_ptr<SimulationResults> SimulationResults::getNewInstance(unsigned in
return std::shared_ptr<SimulationResults>(new SimulationResults(lx, ly, lz, timeStepLength)); 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->timeStep.push_back(timeStep);
this->time.push_back(time); this->time.push_back(time);
...@@ -30,5 +30,6 @@ void SimulationResults::addTimeStep(unsigned int timeStep, unsigned int time, st ...@@ -30,5 +30,6 @@ void SimulationResults::addTimeStep(unsigned int timeStep, unsigned int time, st
this->vz.push_back(vz); this->vz.push_back(vz);
this->press.push_back(press); this->press.push_back(press);
this->rho.push_back(rho); this->rho.push_back(rho);
this->level.push_back(level);
numberOfTimeSteps++; numberOfTimeSteps++;
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ class SimulationResults : public ResultsImp ...@@ -8,7 +8,7 @@ class SimulationResults : public ResultsImp
{ {
public: public:
static std::shared_ptr<SimulationResults> getNewInstance(unsigned int lx, unsigned int ly, unsigned int lz, unsigned int timeStepLength); 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: private:
SimulationResults(unsigned int lx, unsigned int ly, unsigned int lz, unsigned int timeStepLength); SimulationResults(unsigned int lx, unsigned int ly, unsigned int lz, unsigned int timeStepLength);
......
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