diff --git a/AMDiS/src/ResidualEstimator.cc b/AMDiS/src/ResidualEstimator.cc index bf8ae05be00e1016b4db4026746fda94b7a72b27..1b1af2bac3138546ca38cb69557e08d728d80e8e 100644 --- a/AMDiS/src/ResidualEstimator.cc +++ b/AMDiS/src/ResidualEstimator.cc @@ -218,7 +218,7 @@ namespace AMDiS { } } - if (timestep) { + if (timestep && uhOld[system]) { TEST_EXIT_DBG(uhOld[system])("no uhOld\n"); uhOld[system]->getLocalVector(el, uhOldEl[system]); @@ -278,16 +278,14 @@ namespace AMDiS { // add integral over r square 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]; - } - 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; - } else { + else val = C0 * h2 * det * val; - } - + est_el += val; // ===== jump residuals diff --git a/AMDiS/src/Serializer.h b/AMDiS/src/Serializer.h index 49840bec49095211544fb80de53e7558a1ee01fa..37404ab1d504682fe9b7ebe21d7860bf809caf8b 100644 --- a/AMDiS/src/Serializer.h +++ b/AMDiS/src/Serializer.h @@ -1,4 +1,4 @@ - +// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == @@ -34,8 +34,6 @@ namespace AMDiS { class Serializer : public FileWriterInterface { public: - MEMORY_MANAGED(Serializer); - Serializer(ProblemType *problem) : name_(""), problem_(problem), @@ -61,13 +59,13 @@ namespace AMDiS { timestepNumber_++; timestepNumber_ %= tsModulo_; - if ((timestepNumber_ != 0) && !force) { + if ((timestepNumber_ != 0) && !force) return; - } TEST_EXIT(adaptInfo)("No AdaptInfo\n"); std::ofstream out(name_.c_str()); + TEST_EXIT(out.is_open())("Cannot open serialization file!\n"); problem_->serialize(out); adaptInfo->serialize(out); out.close(); @@ -82,24 +80,16 @@ namespace AMDiS { } protected: - /** \brief - * Name of file to which the problem is serialized. - */ + /// Name of file to which the problem is serialized. std::string name_; - /** \brief - * Pointer to the problem. - */ + /// Pointer to the problem. ProblemType *problem_; - /** \brief - * The problem is serialized every tsModulo-th timestep. - */ + /// The problem is serialized every tsModulo-th timestep. int tsModulo_; - /** \brief - * Current timestep number. - */ + /// Current timestep number. int timestepNumber_; };