Commit 553860d9 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Serializer reports error message if the file does not exists; Bugfix for bug #10.

parent 64fe2d8a
...@@ -218,7 +218,7 @@ namespace AMDiS { ...@@ -218,7 +218,7 @@ namespace AMDiS {
} }
} }
if (timestep) { if (timestep && uhOld[system]) {
TEST_EXIT_DBG(uhOld[system])("no uhOld\n"); TEST_EXIT_DBG(uhOld[system])("no uhOld\n");
uhOld[system]->getLocalVector(el, uhOldEl[system]); uhOld[system]->getLocalVector(el, uhOldEl[system]);
...@@ -278,16 +278,14 @@ namespace AMDiS { ...@@ -278,16 +278,14 @@ namespace AMDiS {
// add integral over r square // add integral over r square
val = 0.0; val = 0.0;
for (int iq = 0; iq < nPoints; iq++) { for (int iq = 0; iq < nPoints; iq++)
val += quad->getWeight(iq) * riq[iq] * riq[iq]; val += quad->getWeight(iq) * riq[iq] * riq[iq];
}
if (timestep != 0.0 || norm == NO_NORM || norm == L2_NORM) { if (timestep != 0.0 || norm == NO_NORM || norm == L2_NORM)
val = C0 * h2 * h2 * det * val; val = C0 * h2 * h2 * det * val;
} else { else
val = C0 * h2 * det * val; val = C0 * h2 * det * val;
}
est_el += val; est_el += val;
// ===== jump residuals // ===== jump residuals
......
// ============================================================================
// == == // == ==
// == AMDiS - Adaptive multidimensional simulations == // == AMDiS - Adaptive multidimensional simulations ==
// == == // == ==
...@@ -34,8 +34,6 @@ namespace AMDiS { ...@@ -34,8 +34,6 @@ namespace AMDiS {
class Serializer : public FileWriterInterface class Serializer : public FileWriterInterface
{ {
public: public:
MEMORY_MANAGED(Serializer);
Serializer(ProblemType *problem) Serializer(ProblemType *problem)
: name_(""), : name_(""),
problem_(problem), problem_(problem),
...@@ -61,13 +59,13 @@ namespace AMDiS { ...@@ -61,13 +59,13 @@ namespace AMDiS {
timestepNumber_++; timestepNumber_++;
timestepNumber_ %= tsModulo_; timestepNumber_ %= tsModulo_;
if ((timestepNumber_ != 0) && !force) { if ((timestepNumber_ != 0) && !force)
return; return;
}
TEST_EXIT(adaptInfo)("No AdaptInfo\n"); TEST_EXIT(adaptInfo)("No AdaptInfo\n");
std::ofstream out(name_.c_str()); std::ofstream out(name_.c_str());
TEST_EXIT(out.is_open())("Cannot open serialization file!\n");
problem_->serialize(out); problem_->serialize(out);
adaptInfo->serialize(out); adaptInfo->serialize(out);
out.close(); out.close();
...@@ -82,24 +80,16 @@ namespace AMDiS { ...@@ -82,24 +80,16 @@ namespace AMDiS {
} }
protected: protected:
/** \brief /// Name of file to which the problem is serialized.
* Name of file to which the problem is serialized.
*/
std::string name_; std::string name_;
/** \brief /// Pointer to the problem.
* Pointer to the problem.
*/
ProblemType *problem_; ProblemType *problem_;
/** \brief /// The problem is serialized every tsModulo-th timestep.
* The problem is serialized every tsModulo-th timestep.
*/
int tsModulo_; int tsModulo_;
/** \brief /// Current timestep number.
* Current timestep number.
*/
int timestepNumber_; int timestepNumber_;
}; };
......
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