Commit 90f28a27 authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed serious bug on serialization/deserialization.

parent d2f8df57
......@@ -134,6 +134,7 @@
#if HAVE_PARALLEL_DOMAIN_AMDIS
#include "parallel/InteriorBoundary.h"
#include "parallel/MpiHelper.h"
#include "parallel/StdMpi.h"
#if HAVE_PARALLEL_MTL4
#include "parallel/Mtl4Solver.h"
......
......@@ -85,6 +85,12 @@ namespace AMDiS {
MSG("Deserialization from file: %s\n", queueSerializationFilename.c_str());
std::ifstream in(queueSerializationFilename.c_str() , ios::in);
// Read the revision number of the AMDiS version which was used to create
// the serialization file.
int revNumber = -1;
SerUtil::deserialize(in, revNumber);
deserialize(in);
in.close();
......@@ -108,6 +114,12 @@ namespace AMDiS {
MSG("Deserialization with AdaptInfo from file: %s\n", serializationFilename.c_str());
std::ifstream in(serializationFilename.c_str());
// Read the revision number of the AMDiS version which was used to create
// the serialization file.
int revNumber = -1;
SerUtil::deserialize(in, revNumber);
deserialize(in);
in.close();
}
......@@ -372,7 +384,6 @@ namespace AMDiS {
{
FUNCNAME("AdaptInstationary::serialize()");
SerUtil::serialize(out, amdisRevisionNumber);
problemIteration->serialize(out);
adaptInfo->serialize(out);
if (problemTime)
......@@ -383,8 +394,10 @@ namespace AMDiS {
void AdaptInstationary::deserialize(std::istream &in)
{
FUNCNAME("AdaptInstationary::deserialize()");
if(in.fail())
ERROR_EXIT("File not found for deserialization \n");
if (in.fail())
ERROR_EXIT("File not found for deserialization!\n");
problemIteration->deserialize(in);
adaptInfo->deserialize(in);
if (problemTime)
......
......@@ -120,10 +120,10 @@ namespace AMDiS {
{
if (this->feSpace && this->feSpace->getAdmin())
(this->feSpace->getAdmin())->removeDOFIndexed(this);
if (this->boundaryManager)
delete this->boundaryManager;
vec.clear();
}
......
......@@ -15,8 +15,8 @@ namespace AMDiS {
{
size_t pos = line.find(':');
if (pos == string::npos) {
throw runtime_error("cannot find the delimiter ':' in line "
"'" + line + "'");
throw runtime_error("cannot find the delimiter ':' in line "
"'" + line + "'");
}
name = line.substr(0, pos);
value = line.substr(pos + 1, line.length() - (pos + 1));
......@@ -24,7 +24,7 @@ namespace AMDiS {
// remove everything after the %
pos = value.find('%');
if (pos != string::npos)
value = value.substr(0, pos);
value = value.substr(0, pos);
}
string name;
string value;
......@@ -72,7 +72,7 @@ namespace AMDiS {
char swap[line_length];
in.getline(swap, line_length);
while (in.good() || in.gcount()>0) {
std::string whitespaces = " \t\r\f";
std::string whitespaces = " \t\r\f\n";
std::string sw(swap);
size_t pos0 = sw.find_first_not_of(whitespaces);
......
......@@ -217,9 +217,14 @@ namespace AMDiS {
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
MSG("Deserialization from file: %s\n", serializationFilename.c_str());
ifstream in(serializationFilename.c_str());
// Read the revision number of the AMDiS version which was used to create
// the serialization file.
int revNumber = -1;
SerUtil::deserialize(in, revNumber);
deserialize(in);
in.close();
#endif
deserialized = true;
......@@ -1697,8 +1702,8 @@ namespace AMDiS {
void ProblemStatSeq::deserialize(istream &in)
{
FUNCNAME("ProblemStat::deserialize()");
if(in.fail())
ERROR_EXIT("File not found for deserialization \n");
if (in.fail())
ERROR_EXIT("File not found for deserialization!\n");
for (unsigned int i = 0; i < meshes.size(); i++)
meshes[i]->deserialize(in);
......
......@@ -349,6 +349,11 @@ namespace AMDiS {
if (feSpace != NULL) {
vector<FiniteElemSpace*> feSpaces = probStat->getFeSpaces();
for (unsigned int i = 0; i < feSpaces.size(); i++) {
MSG("MESH %p <-> %p BF %p <-> %p\n",
feSpace->getMesh(),
feSpaces[i]->getMesh(),
feSpace->getBasisFcts(),
feSpaces[i]->getBasisFcts());
TEST_EXIT(feSpace == feSpaces[i])
("Parallelizaton is not supported for multiple FE spaces!\n");
}
......@@ -409,6 +414,11 @@ namespace AMDiS {
TEST_EXIT(!in.fail())("Could not open deserialization file: %s\n",
filename.c_str());
// Read the revision number of the AMDiS version which was used to create
// the serialization file.
int revNumber = -1;
SerUtil::deserialize(in, revNumber);
probStat->deserialize(in);
in.close();
MSG("Deserialization from file: %s\n", filename.c_str());
......@@ -424,6 +434,11 @@ namespace AMDiS {
TEST_EXIT(!in.fail())("Could not open parallel deserialization file: %s\n",
filename.c_str());
// Read the revision number of the AMDiS version which was used to create
// the serialization file.
revNumber = -1;
SerUtil::deserialize(in, revNumber);
deserialize(in);
in.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