Commit b782f6d3 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* isDeserialized_ moved from AdaptInstationary to AdaptInfo

parent 3e4a0cc6
...@@ -169,7 +169,8 @@ namespace AMDiS { ...@@ -169,7 +169,8 @@ namespace AMDiS {
maxSolverIterations(0), maxSolverIterations(0),
solverTolerance(1e-8), solverTolerance(1e-8),
solverResidual(0.0), solverResidual(0.0),
scalContents(size) scalContents(size),
isDeserialized_(false)
{ {
GET_PARAMETER(0, name_ + "->start time", "%f", &startTime); GET_PARAMETER(0, name_ + "->start time", "%f", &startTime);
time = startTime; time = startTime;
...@@ -675,6 +676,17 @@ namespace AMDiS { ...@@ -675,6 +676,17 @@ namespace AMDiS {
return solverResidual; return solverResidual;
}; };
/** \brief
* Returns true, if the adaptive procedure was deserialized from a file.
*/
const bool isDeserialized() const {
return isDeserialized_;
}
inline void setIsDeserialized(bool b) {
isDeserialized_ = b;
}
/** \brief /** \brief
* Creates new scalContents with the given size. * Creates new scalContents with the given size.
*/ */
...@@ -782,6 +794,11 @@ namespace AMDiS { ...@@ -782,6 +794,11 @@ namespace AMDiS {
* Scalar adapt infos. * Scalar adapt infos.
*/ */
Vector<ScalContent*> scalContents; Vector<ScalContent*> scalContents;
/** \brief
* Is true, if the adaptive procedure was deserialized from a file.
*/
bool isDeserialized_;
}; };
} }
......
...@@ -15,8 +15,7 @@ namespace AMDiS { ...@@ -15,8 +15,7 @@ namespace AMDiS {
AdaptInfo *initialInfo, AdaptInfo *initialInfo,
time_t initialTimestamp) time_t initialTimestamp)
: AdaptBase(name, problemStat, info, problemInstat, initialInfo), : AdaptBase(name, problemStat, info, problemInstat, initialInfo),
breakWhenStable(0), breakWhenStable(0)
isDeserialized_(false)
{ {
FUNCNAME("AdaptInstationary::AdaptInstationary()"); FUNCNAME("AdaptInstationary::AdaptInstationary()");
...@@ -43,7 +42,8 @@ namespace AMDiS { ...@@ -43,7 +42,8 @@ namespace AMDiS {
deserialize(in); deserialize(in);
in.close(); in.close();
isDeserialized_ = true; info->setIsDeserialized(true);
initialInfo->setIsDeserialized(true);
} else { } else {
int readSerialization = 0; int readSerialization = 0;
int readSerializationWithAdaptInfo = 0; int readSerializationWithAdaptInfo = 0;
......
...@@ -70,11 +70,10 @@ namespace AMDiS { ...@@ -70,11 +70,10 @@ namespace AMDiS {
* Implementation of CreatorInterface::create(). * Implementation of CreatorInterface::create().
*/ */
SystemVector *create() { SystemVector *create() {
int i;
char number[10]; char number[10];
::std::string numberedName; ::std::string numberedName;
SystemVector *result = NEW SystemVector(name, feSpace, size); SystemVector *result = NEW SystemVector(name, feSpace, size);
for(i=0; i < size; i++) { for (int i = 0; i < size; i++) {
sprintf(number, "[%d]", i); sprintf(number, "[%d]", i);
numberedName = name + ::std::string(number); numberedName = name + ::std::string(number);
result->setDOFVector(i, NEW DOFVector<double>(feSpace[i], numberedName)); result->setDOFVector(i, NEW DOFVector<double>(feSpace[i], numberedName));
...@@ -323,8 +322,8 @@ namespace AMDiS { ...@@ -323,8 +322,8 @@ namespace AMDiS {
* multiplication with scalar * multiplication with scalar
*/ */
inline const SystemVector& operator*=(SystemVector& x, double d) { inline const SystemVector& operator*=(SystemVector& x, double d) {
int i, size = x.getNumVectors(); int size = x.getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
*(x.getDOFVector(i)) *= d; *(x.getDOFVector(i)) *= d;
} }
return x; return x;
...@@ -337,8 +336,8 @@ namespace AMDiS { ...@@ -337,8 +336,8 @@ namespace AMDiS {
TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors()) TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
("invalid size\n"); ("invalid size\n");
double result = 0.0; double result = 0.0;
int i, size = x.getNumVectors(); int size = x.getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
result += (*x.getDOFVector(i)) * (*y.getDOFVector(i)); result += (*x.getDOFVector(i)) * (*y.getDOFVector(i));
}; };
return result; return result;
...@@ -352,8 +351,8 @@ namespace AMDiS { ...@@ -352,8 +351,8 @@ namespace AMDiS {
{ {
TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors()) TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
("invalid size\n"); ("invalid size\n");
int i, size = x.getNumVectors(); int size = x.getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
(*(x.getDOFVector(i))) += (*(y.getDOFVector(i))); (*(x.getDOFVector(i))) += (*(y.getDOFVector(i)));
} }
return x; return x;
...@@ -367,8 +366,8 @@ namespace AMDiS { ...@@ -367,8 +366,8 @@ namespace AMDiS {
{ {
TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors()) TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
("invalid size\n"); ("invalid size\n");
int i, size = x.getNumVectors(); int size = x.getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
(*(x.getDOFVector(i))) -= (*(y.getDOFVector(i))); (*(x.getDOFVector(i))) -= (*(y.getDOFVector(i)));
} }
return x; return x;
...@@ -379,8 +378,8 @@ namespace AMDiS { ...@@ -379,8 +378,8 @@ namespace AMDiS {
*/ */
inline SystemVector operator*(SystemVector& x, double d) { inline SystemVector operator*(SystemVector& x, double d) {
SystemVector result = x; SystemVector result = x;
int i, size = x.getNumVectors(); int size = x.getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
(*(result.getDOFVector(i))) *= d; (*(result.getDOFVector(i))) *= d;
} }
return result; return result;
...@@ -391,8 +390,8 @@ namespace AMDiS { ...@@ -391,8 +390,8 @@ namespace AMDiS {
*/ */
inline SystemVector operator*(double d, SystemVector& x) { inline SystemVector operator*(double d, SystemVector& x) {
SystemVector result = x; SystemVector result = x;
int i, size = x.getNumVectors(); int size = x.getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
(*(result.getDOFVector(i))) *= d; (*(result.getDOFVector(i))) *= d;
} }
return result; return result;
...@@ -407,8 +406,8 @@ namespace AMDiS { ...@@ -407,8 +406,8 @@ namespace AMDiS {
TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors()) TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
("invalid size\n"); ("invalid size\n");
SystemVector result = x; SystemVector result = x;
int i, size = x.getNumVectors(); int size = x.getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
(*(result.getDOFVector(i))) += (*(y.getDOFVector(i))); (*(result.getDOFVector(i))) += (*(y.getDOFVector(i)));
} }
return result; return result;
...@@ -433,8 +432,8 @@ namespace AMDiS { ...@@ -433,8 +432,8 @@ namespace AMDiS {
*/ */
inline double norm(SystemVector* x) { inline double norm(SystemVector* x) {
double result = 0.0; double result = 0.0;
int i, size = x->getNumVectors(); int size = x->getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
result += x->getDOFVector(i)->squareNrm2(); result += x->getDOFVector(i)->squareNrm2();
} }
return sqrt(result); return sqrt(result);
...@@ -445,8 +444,8 @@ namespace AMDiS { ...@@ -445,8 +444,8 @@ namespace AMDiS {
*/ */
inline double L2Norm(SystemVector* x) { inline double L2Norm(SystemVector* x) {
double result = 0.0; double result = 0.0;
int i, size = x->getNumVectors(); int size = x->getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
result += x->getDOFVector(i)->L2NormSquare(); result += x->getDOFVector(i)->L2NormSquare();
} }
return sqrt(result); return sqrt(result);
...@@ -457,8 +456,8 @@ namespace AMDiS { ...@@ -457,8 +456,8 @@ namespace AMDiS {
*/ */
inline double H1Norm(SystemVector* x) { inline double H1Norm(SystemVector* x) {
double result = 0.0; double result = 0.0;
int i, size = x->getNumVectors(); int size = x->getNumVectors();
for(i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
result += x->getDOFVector(i)->H1NormSquare(); result += x->getDOFVector(i)->H1NormSquare();
} }
return sqrt(result); return sqrt(result);
......
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