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

Fixed serious bug on serialization/deserialization.

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