From 7bc608671d7b1896abad9c0964009a14485c099d Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Mon, 29 Sep 2008 09:31:58 +0000 Subject: [PATCH] * Delayed writing removed --- AMDiS/src/AdaptInstationary.cc | 18 ---------------- AMDiS/src/ElementFileWriter.h | 6 ------ AMDiS/src/FileWriter.cc | 35 +------------------------------- AMDiS/src/FileWriter.h | 33 ------------------------------ AMDiS/src/ProblemInstat.cc | 20 ------------------ AMDiS/src/ProblemInstat.h | 20 ++++-------------- AMDiS/src/ProblemScal.cc | 17 ---------------- AMDiS/src/ProblemScal.h | 10 --------- AMDiS/src/ProblemTimeInterface.h | 11 ---------- AMDiS/src/ProblemVec.cc | 17 ---------------- AMDiS/src/ProblemVec.h | 10 --------- AMDiS/src/VtkWriter.cc | 1 + 12 files changed, 6 insertions(+), 192 deletions(-) diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc index eca9783c..d185d75e 100644 --- a/AMDiS/src/AdaptInstationary.cc +++ b/AMDiS/src/AdaptInstationary.cc @@ -217,23 +217,7 @@ namespace AMDiS { problemTime_->initTimestep(adaptInfo_); -#ifdef _OPENMP - if (problemTime_->existsDelayedCalculation()) { -#pragma omp parallel sections num_threads(2) - { -#pragma omp section - problemTime_->startDelayedTimestepCalculation(); - -#pragma omp section - oneTimestep(); - } - } else { - oneTimestep(); - } -#else - problemTime_->startDelayedTimestepCalculation(); oneTimestep(); -#endif problemTime_->closeTimestep(adaptInfo_); @@ -250,8 +234,6 @@ namespace AMDiS { } } - problemTime_->startDelayedTimestepCalculation(); - return errorCode; } diff --git a/AMDiS/src/ElementFileWriter.h b/AMDiS/src/ElementFileWriter.h index 44d5b171..3ba74474 100644 --- a/AMDiS/src/ElementFileWriter.h +++ b/AMDiS/src/ElementFileWriter.h @@ -30,12 +30,6 @@ namespace AMDiS { Flag traverseFlag = Mesh::CALL_LEAF_EL, bool (*writeElem)(ElInfo*) = NULL); - void writeDelayedFiles() {}; - - bool isWritingDelayed() { - return false; - }; - protected: /** * Writes element data in tecplot format. diff --git a/AMDiS/src/FileWriter.cc b/AMDiS/src/FileWriter.cc index aa53fe1d..9278930e 100644 --- a/AMDiS/src/FileWriter.cc +++ b/AMDiS/src/FileWriter.cc @@ -111,10 +111,7 @@ namespace AMDiS { indexDecimals = 3; tsModulo = 1; nTmpSolutions_ = 0; - delayWriting_ = 0; - writingIsDelayed_ = false; - delayedFilename_ = ""; - paraViewAnimationFrames_.resize(0); + paraViewAnimationFrames_.resize(0), compression = NONE; readParameters(); @@ -139,7 +136,6 @@ namespace AMDiS { GET_PARAMETER(0, name + "->index length", "%d", &indexLength); GET_PARAMETER(0, name + "->index decimals", "%d", &indexDecimals); GET_PARAMETER(0, name + "->write every i-th timestep", "%d", &tsModulo); - GET_PARAMETER(0, name + "->delay", "%d", &delayWriting_); std::string compressionStr = ""; GET_PARAMETER(0, name + "->compression", &compressionStr); @@ -148,9 +144,6 @@ namespace AMDiS { } else if ((compressionStr == "bzip2") || (compressionStr == "bz2")) { compression = BZIP2; } - - TEST_EXIT(!delayWriting_ || amdisHaveOpenMP) - ("Delayed writing only possible with OpenMP support!\n"); } void FileWriter::writeFiles(AdaptInfo *adaptInfo, @@ -164,10 +157,6 @@ namespace AMDiS { if ((adaptInfo->getTimestepNumber() % tsModulo != 0) && !force) return; - if (writingIsDelayed_) { - ERROR_EXIT("This should not happen!\n"); - } - // Containers, which store the data to be written; std::vector< DataCollector* > dataCollectors(solutionVecs_.size()); @@ -199,24 +188,6 @@ namespace AMDiS { fn += timeStr; } - - if (delayWriting_) { - if (writeTecPlotFormat || writeAMDiSFormat || writePeriodicFormat) { - ERROR_EXIT("Delay writing only supported for ParaView file format!\n"); - } - - for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++) { - dataCollectors[i]->fillAllData(); - } - - writingIsDelayed_ = true; - delayedFilename_ = fn; - - MSG("Delayed writing of ParaView file %s\n", (fn + paraViewFileExt).c_str()); - - return; - } - if (writeTecPlotFormat) { TecPlotWriter<DOFVector<double> >::writeValues(solutionVecs_[0], const_cast<char*>((fn + tecplotExt).c_str()), @@ -266,8 +237,4 @@ namespace AMDiS { } } - void FileWriter::writeDelayedFiles() - { - ERROR_EXIT("no more!\n"); - } } diff --git a/AMDiS/src/FileWriter.h b/AMDiS/src/FileWriter.h index 40469ecc..b33952ed 100644 --- a/AMDiS/src/FileWriter.h +++ b/AMDiS/src/FileWriter.h @@ -77,10 +77,6 @@ namespace AMDiS { Flag traverseFlag = Mesh::CALL_LEAF_EL, bool (*writeElem)(ElInfo*) = NULL) = 0; - virtual void writeDelayedFiles() = 0; - - virtual bool isWritingDelayed() = 0; - void setTraverseProperties(int level, Flag flag, bool (*writeElem)(ElInfo*)) @@ -162,18 +158,6 @@ namespace AMDiS { Flag traverseFlag = Mesh::CALL_LEAF_EL, bool (*writeElem)(ElInfo*) = NULL); - /** \brief - * Starts the delayed writing. - */ - virtual void writeDelayedFiles(); - - /** \brief - * Returns true, if the file writer is waiting to start writing. - */ - bool isWritingDelayed() { - return writingIsDelayed_; - } - protected: /** \brief * Initialization of the filewriter. @@ -297,23 +281,6 @@ namespace AMDiS { */ int nTmpSolutions_; - /** \brief - * If set to 1, the FileWriter will delay the file writing to the future, where - * it can be executed in parallel with some other independent calculations. - */ - int delayWriting_; - - /** \brief - * If set to true, the FileWriter was filled with data, but the Files are currently - * not written to disk. - */ - bool writingIsDelayed_; - - /** \brief - * Here the filename for the file, which should be written to the next, is stored. - */ - std::string delayedFilename_; - /** \brief * Defines if, and with what kind of compression, the file should be compressed * during writing. diff --git a/AMDiS/src/ProblemInstat.cc b/AMDiS/src/ProblemInstat.cc index ffda85ef..1b3dbe41 100644 --- a/AMDiS/src/ProblemInstat.cc +++ b/AMDiS/src/ProblemInstat.cc @@ -185,24 +185,4 @@ namespace AMDiS { void ProblemInstatVec::initTimestep(AdaptInfo *adaptInfo) { oldSolution->copy(*(problemStat->getSolution())); } - - void ProblemInstatScal::startDelayedTimestepCalculation() - { - problemStat->writeDelayedFiles(); - } - - void ProblemInstatVec::startDelayedTimestepCalculation() - { - problemStat->writeDelayedFiles(); - } - - bool ProblemInstatScal::existsDelayedCalculation() - { - return problemStat->existsDelayedCalculation(); - } - - bool ProblemInstatVec::existsDelayedCalculation() - { - return problemStat->existsDelayedCalculation(); - } } diff --git a/AMDiS/src/ProblemInstat.h b/AMDiS/src/ProblemInstat.h index 351dc864..e3bd1d1a 100644 --- a/AMDiS/src/ProblemInstat.h +++ b/AMDiS/src/ProblemInstat.h @@ -121,10 +121,6 @@ namespace AMDiS { */ virtual void solveInitialProblem(AdaptInfo *adaptInfo); - /** \brief - * Implements the parallel file writing for instationary problems. - */ - virtual void startDelayedTimestepCalculation() {}; protected: /** \brief @@ -204,13 +200,9 @@ namespace AMDiS { */ virtual void transferInitialSolution(AdaptInfo *adaptInfo); - virtual void startDelayedTimestepCalculation(); - - virtual bool existsDelayedCalculation(); virtual void serialize(std::ostream &out) {}; - virtual void deserialize(std::istream &in) {}; protected: @@ -281,27 +273,23 @@ namespace AMDiS { */ inline ProblemVec* getStatProblem() { return problemStat; - }; + } /** \brief * Returns \ref oldSolution. */ inline SystemVector *getOldSolution() { return oldSolution; - }; + } /** \brief * Used by \ref problemInitial */ virtual void transferInitialSolution(AdaptInfo *adaptInfo); - virtual void startDelayedTimestepCalculation(); - - virtual bool existsDelayedCalculation(); + virtual void serialize(std::ostream &out) {} - virtual void serialize(std::ostream &out) {}; - - virtual void deserialize(std::istream &in) {}; + virtual void deserialize(std::istream &in) {} protected: /** \brief diff --git a/AMDiS/src/ProblemScal.cc b/AMDiS/src/ProblemScal.cc index 3d65398e..f3d1f178 100644 --- a/AMDiS/src/ProblemScal.cc +++ b/AMDiS/src/ProblemScal.cc @@ -35,23 +35,6 @@ namespace AMDiS { } } - void ProblemScal::writeDelayedFiles() - { - for (int i = 0; i < static_cast<int>(fileWriters_.size()); i++) { - fileWriters_[i]->writeDelayedFiles(); - } - } - - bool ProblemScal::existsDelayedCalculation() - { - for (int i = 0; i < static_cast<int>(fileWriters_.size()); i++) { - if (fileWriters_[i]->isWritingDelayed()) - return true; - } - - return false; - } - void ProblemScal::interpolInitialSolution(AbstractFunction<double, WorldVector<double> > *fct) { solution_->interpol(fct); diff --git a/AMDiS/src/ProblemScal.h b/AMDiS/src/ProblemScal.h index a61a1de1..d60bf76e 100644 --- a/AMDiS/src/ProblemScal.h +++ b/AMDiS/src/ProblemScal.h @@ -201,16 +201,6 @@ namespace AMDiS { */ void writeFiles(AdaptInfo *adaptInfo, bool force); - /** \brief - * Startes parallel output writing; - */ - void writeDelayedFiles(); - - /** \brief - * Returns true, if there is calculation waiting to be started. - */ - bool existsDelayedCalculation(); - /** \brief * Interpolates fct to \ref solution. */ diff --git a/AMDiS/src/ProblemTimeInterface.h b/AMDiS/src/ProblemTimeInterface.h index ca71227c..cb5600b4 100644 --- a/AMDiS/src/ProblemTimeInterface.h +++ b/AMDiS/src/ProblemTimeInterface.h @@ -69,17 +69,6 @@ namespace AMDiS { */ virtual void transferInitialSolution(AdaptInfo *adaptInfo) = 0; - /** \brief - * Starts calculations from the last timestep, which can be done in parallel - * with the calculations of the current timestep; - */ - virtual void startDelayedTimestepCalculation() = 0; - - /** \brief - * Returns true, if there is some delayed calculation waiting to be started. - */ - virtual bool existsDelayedCalculation() = 0; - /** \brief * Function that serializes the problem plus information about the iteration. */ diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 66b8d221..76d4b385 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -793,23 +793,6 @@ namespace AMDiS { #endif } - void ProblemVec::writeDelayedFiles() - { - for (int i = 0; i < static_cast<int>(fileWriters_.size()); i++) { - fileWriters_[i]->writeDelayedFiles(); - } - } - - bool ProblemVec::existsDelayedCalculation() - { - for (int i = 0; i < static_cast<int>(fileWriters_.size()); i++) { - if (fileWriters_[i]->isWritingDelayed()) - return true; - } - - return false; - } - void ProblemVec::interpolInitialSolution(std::vector<AbstractFunction<double, WorldVector<double> >*> *fct) { FUNCNAME("ProblemVec::interpolInitialSolution()"); diff --git a/AMDiS/src/ProblemVec.h b/AMDiS/src/ProblemVec.h index fd29d2e4..e3c6b650 100644 --- a/AMDiS/src/ProblemVec.h +++ b/AMDiS/src/ProblemVec.h @@ -229,16 +229,6 @@ namespace AMDiS { */ void writeFiles(AdaptInfo *adaptInfo, bool force); - /** \brief - * Startes parallel output writing; - */ - void writeDelayedFiles(); - - /** \brief - * Returns true, if there is calculation waiting to be started. - */ - bool existsDelayedCalculation(); - /** \brief * Interpolates fct to \ref solution. */ diff --git a/AMDiS/src/VtkWriter.cc b/AMDiS/src/VtkWriter.cc index e9ff0ce7..0e4aa54f 100644 --- a/AMDiS/src/VtkWriter.cc +++ b/AMDiS/src/VtkWriter.cc @@ -35,6 +35,7 @@ namespace AMDiS { std::ofstream file; file.open(name); + TEST_EXIT(file.is_open())("Cannot open file %s for writing\n", name); writeFile(file); file.close(); -- GitLab