Commit 7bc60867 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Delayed writing removed

parent ecf4d835
...@@ -217,23 +217,7 @@ namespace AMDiS { ...@@ -217,23 +217,7 @@ namespace AMDiS {
problemTime_->initTimestep(adaptInfo_); 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(); oneTimestep();
#endif
problemTime_->closeTimestep(adaptInfo_); problemTime_->closeTimestep(adaptInfo_);
...@@ -250,8 +234,6 @@ namespace AMDiS { ...@@ -250,8 +234,6 @@ namespace AMDiS {
} }
} }
problemTime_->startDelayedTimestepCalculation();
return errorCode; return errorCode;
} }
......
...@@ -30,12 +30,6 @@ namespace AMDiS { ...@@ -30,12 +30,6 @@ namespace AMDiS {
Flag traverseFlag = Mesh::CALL_LEAF_EL, Flag traverseFlag = Mesh::CALL_LEAF_EL,
bool (*writeElem)(ElInfo*) = NULL); bool (*writeElem)(ElInfo*) = NULL);
void writeDelayedFiles() {};
bool isWritingDelayed() {
return false;
};
protected: protected:
/** /**
* Writes element data in tecplot format. * Writes element data in tecplot format.
......
...@@ -111,10 +111,7 @@ namespace AMDiS { ...@@ -111,10 +111,7 @@ namespace AMDiS {
indexDecimals = 3; indexDecimals = 3;
tsModulo = 1; tsModulo = 1;
nTmpSolutions_ = 0; nTmpSolutions_ = 0;
delayWriting_ = 0; paraViewAnimationFrames_.resize(0),
writingIsDelayed_ = false;
delayedFilename_ = "";
paraViewAnimationFrames_.resize(0);
compression = NONE; compression = NONE;
readParameters(); readParameters();
...@@ -139,7 +136,6 @@ namespace AMDiS { ...@@ -139,7 +136,6 @@ namespace AMDiS {
GET_PARAMETER(0, name + "->index length", "%d", &indexLength); GET_PARAMETER(0, name + "->index length", "%d", &indexLength);
GET_PARAMETER(0, name + "->index decimals", "%d", &indexDecimals); GET_PARAMETER(0, name + "->index decimals", "%d", &indexDecimals);
GET_PARAMETER(0, name + "->write every i-th timestep", "%d", &tsModulo); GET_PARAMETER(0, name + "->write every i-th timestep", "%d", &tsModulo);
GET_PARAMETER(0, name + "->delay", "%d", &delayWriting_);
std::string compressionStr = ""; std::string compressionStr = "";
GET_PARAMETER(0, name + "->compression", &compressionStr); GET_PARAMETER(0, name + "->compression", &compressionStr);
...@@ -148,9 +144,6 @@ namespace AMDiS { ...@@ -148,9 +144,6 @@ namespace AMDiS {
} else if ((compressionStr == "bzip2") || (compressionStr == "bz2")) { } else if ((compressionStr == "bzip2") || (compressionStr == "bz2")) {
compression = BZIP2; compression = BZIP2;
} }
TEST_EXIT(!delayWriting_ || amdisHaveOpenMP)
("Delayed writing only possible with OpenMP support!\n");
} }
void FileWriter::writeFiles(AdaptInfo *adaptInfo, void FileWriter::writeFiles(AdaptInfo *adaptInfo,
...@@ -164,10 +157,6 @@ namespace AMDiS { ...@@ -164,10 +157,6 @@ namespace AMDiS {
if ((adaptInfo->getTimestepNumber() % tsModulo != 0) && !force) if ((adaptInfo->getTimestepNumber() % tsModulo != 0) && !force)
return; return;
if (writingIsDelayed_) {
ERROR_EXIT("This should not happen!\n");
}
// Containers, which store the data to be written; // Containers, which store the data to be written;
std::vector< DataCollector* > dataCollectors(solutionVecs_.size()); std::vector< DataCollector* > dataCollectors(solutionVecs_.size());
...@@ -199,24 +188,6 @@ namespace AMDiS { ...@@ -199,24 +188,6 @@ namespace AMDiS {
fn += timeStr; 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) { if (writeTecPlotFormat) {
TecPlotWriter<DOFVector<double> >::writeValues(solutionVecs_[0], TecPlotWriter<DOFVector<double> >::writeValues(solutionVecs_[0],
const_cast<char*>((fn + tecplotExt).c_str()), const_cast<char*>((fn + tecplotExt).c_str()),
...@@ -266,8 +237,4 @@ namespace AMDiS { ...@@ -266,8 +237,4 @@ namespace AMDiS {
} }
} }
void FileWriter::writeDelayedFiles()
{
ERROR_EXIT("no more!\n");
}
} }
...@@ -77,10 +77,6 @@ namespace AMDiS { ...@@ -77,10 +77,6 @@ namespace AMDiS {
Flag traverseFlag = Mesh::CALL_LEAF_EL, Flag traverseFlag = Mesh::CALL_LEAF_EL,
bool (*writeElem)(ElInfo*) = NULL) = 0; bool (*writeElem)(ElInfo*) = NULL) = 0;
virtual void writeDelayedFiles() = 0;
virtual bool isWritingDelayed() = 0;
void setTraverseProperties(int level, void setTraverseProperties(int level,
Flag flag, Flag flag,
bool (*writeElem)(ElInfo*)) bool (*writeElem)(ElInfo*))
...@@ -162,18 +158,6 @@ namespace AMDiS { ...@@ -162,18 +158,6 @@ namespace AMDiS {
Flag traverseFlag = Mesh::CALL_LEAF_EL, Flag traverseFlag = Mesh::CALL_LEAF_EL,
bool (*writeElem)(ElInfo*) = NULL); 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: protected:
/** \brief /** \brief
* Initialization of the filewriter. * Initialization of the filewriter.
...@@ -297,23 +281,6 @@ namespace AMDiS { ...@@ -297,23 +281,6 @@ namespace AMDiS {
*/ */
int nTmpSolutions_; 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 /** \brief
* Defines if, and with what kind of compression, the file should be compressed * Defines if, and with what kind of compression, the file should be compressed
* during writing. * during writing.
......
...@@ -185,24 +185,4 @@ namespace AMDiS { ...@@ -185,24 +185,4 @@ namespace AMDiS {
void ProblemInstatVec::initTimestep(AdaptInfo *adaptInfo) { void ProblemInstatVec::initTimestep(AdaptInfo *adaptInfo) {
oldSolution->copy(*(problemStat->getSolution())); 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();
}
} }
...@@ -121,10 +121,6 @@ namespace AMDiS { ...@@ -121,10 +121,6 @@ namespace AMDiS {
*/ */
virtual void solveInitialProblem(AdaptInfo *adaptInfo); virtual void solveInitialProblem(AdaptInfo *adaptInfo);
/** \brief
* Implements the parallel file writing for instationary problems.
*/
virtual void startDelayedTimestepCalculation() {};
protected: protected:
/** \brief /** \brief
...@@ -204,13 +200,9 @@ namespace AMDiS { ...@@ -204,13 +200,9 @@ namespace AMDiS {
*/ */
virtual void transferInitialSolution(AdaptInfo *adaptInfo); 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: protected:
...@@ -281,27 +273,23 @@ namespace AMDiS { ...@@ -281,27 +273,23 @@ namespace AMDiS {
*/ */
inline ProblemVec* getStatProblem() { inline ProblemVec* getStatProblem() {
return problemStat; return problemStat;
}; }
/** \brief /** \brief
* Returns \ref oldSolution. * Returns \ref oldSolution.
*/ */
inline SystemVector *getOldSolution() { inline SystemVector *getOldSolution() {
return oldSolution; return oldSolution;
}; }
/** \brief /** \brief
* Used by \ref problemInitial * Used by \ref problemInitial
*/ */
virtual void transferInitialSolution(AdaptInfo *adaptInfo); virtual void transferInitialSolution(AdaptInfo *adaptInfo);
virtual void startDelayedTimestepCalculation(); virtual void serialize(std::ostream &out) {}
virtual bool existsDelayedCalculation();
virtual void serialize(std::ostream &out) {}; virtual void deserialize(std::istream &in) {}
virtual void deserialize(std::istream &in) {};
protected: protected:
/** \brief /** \brief
......
...@@ -35,23 +35,6 @@ namespace AMDiS { ...@@ -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) void ProblemScal::interpolInitialSolution(AbstractFunction<double, WorldVector<double> > *fct)
{ {
solution_->interpol(fct); solution_->interpol(fct);
......
...@@ -201,16 +201,6 @@ namespace AMDiS { ...@@ -201,16 +201,6 @@ namespace AMDiS {
*/ */
void writeFiles(AdaptInfo *adaptInfo, bool force); 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 /** \brief
* Interpolates fct to \ref solution. * Interpolates fct to \ref solution.
*/ */
......
...@@ -69,17 +69,6 @@ namespace AMDiS { ...@@ -69,17 +69,6 @@ namespace AMDiS {
*/ */
virtual void transferInitialSolution(AdaptInfo *adaptInfo) = 0; 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 /** \brief
* Function that serializes the problem plus information about the iteration. * Function that serializes the problem plus information about the iteration.
*/ */
......
...@@ -793,23 +793,6 @@ namespace AMDiS { ...@@ -793,23 +793,6 @@ namespace AMDiS {
#endif #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) void ProblemVec::interpolInitialSolution(std::vector<AbstractFunction<double, WorldVector<double> >*> *fct)
{ {
FUNCNAME("ProblemVec::interpolInitialSolution()"); FUNCNAME("ProblemVec::interpolInitialSolution()");
......
...@@ -229,16 +229,6 @@ namespace AMDiS { ...@@ -229,16 +229,6 @@ namespace AMDiS {
*/ */
void writeFiles(AdaptInfo *adaptInfo, bool force); 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 /** \brief
* Interpolates fct to \ref solution. * Interpolates fct to \ref solution.
*/ */
......
...@@ -35,6 +35,7 @@ namespace AMDiS { ...@@ -35,6 +35,7 @@ namespace AMDiS {
std::ofstream file; std::ofstream file;
file.open(name); file.open(name);
TEST_EXIT(file.is_open())("Cannot open file %s for writing\n", name);
writeFile(file); writeFile(file);
file.close(); file.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment