diff --git a/AMDiS/src/SolutionDataStorage.hh b/AMDiS/src/SolutionDataStorage.hh index 09db6a3bc3284b2d0cbec6e984f90b84340fbf82..4e108a41f2994b6ee954a2d62bef71a4480eeaee 100644 --- a/AMDiS/src/SolutionDataStorage.hh +++ b/AMDiS/src/SolutionDataStorage.hh @@ -50,6 +50,12 @@ namespace AMDiS { ERROR_EXIT("Not yet\n"); } + // If pop was the last operation, cleanup and reset the data storage. + if (poped) { + clear(); + poped = false; + } + std::vector<FiniteElemSpace*> feSpace(solution->getFESpaces().size()); for (int i = 0; i < feSpace.size(); i++) { feSpace[i] = NEW FiniteElemSpace(); @@ -65,12 +71,6 @@ namespace AMDiS { vec->interpol(solution, 1.0); memoryUsage += vec->calcMemoryUsage(); - // If pop was the last operation, cleanup and reset the data storage. - if (poped) { - clear(); - poped = false; - } - solutions.push_back(vec); timestamps.push_back(timestamp); @@ -97,7 +97,7 @@ namespace AMDiS { template<typename T> void SolutionDataStorage<T>::clear() { - for (int i = 1; i < static_cast<int>(solutions.size()); i++) { + for (int i = 0; i < static_cast<int>(solutions.size()); i++) { DELETE solutions[i]; }