Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
// ============================================================================
// == ==
// == 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_;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment