Commit 3c846dd3 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Deleted directory AMDiS/src/AMDiS

* Added ParaReal files
parent cf094515
...@@ -511,12 +511,15 @@ namespace AMDiS { ...@@ -511,12 +511,15 @@ namespace AMDiS {
*/ */
inline double setTimestep(double t) { inline double setTimestep(double t) {
timestep = t; timestep = t;
if (timestep > maxTimestep) if (timestep > maxTimestep) {
timestep = maxTimestep; timestep = maxTimestep;
if (timestep < minTimestep) }
if (timestep < minTimestep) {
timestep = minTimestep; timestep = minTimestep;
if (time + timestep > endTime) }
if (time + timestep > endTime) {
timestep = endTime - time; timestep = endTime - time;
}
return timestep; return timestep;
}; };
...@@ -692,6 +695,21 @@ namespace AMDiS { ...@@ -692,6 +695,21 @@ namespace AMDiS {
*/ */
void setScalContents(int newSize); void setScalContents(int newSize);
/** \brief
* Resets timestep, current time and time boundaries without
* any check. Is used by the parareal algorithm.
*/
void resetTimeValues(double newTimeStep,
double newStartTime,
double newEndTime)
{
time = newStartTime;
startTime = newStartTime;
endTime = newEndTime;
timestep = newTimeStep;
timestepNumber = 0;
}
// ===== Serialiazable implementation ===== // ===== Serialiazable implementation =====
void serialize(::std::ostream& out); void serialize(::std::ostream& out);
......
...@@ -1401,19 +1401,17 @@ namespace AMDiS { ...@@ -1401,19 +1401,17 @@ namespace AMDiS {
rememberElVec = true; rememberElVec = true;
} }
if (rememberElVec && !elementVector) if (rememberElVec && !elementVector) {
elementVector = NEW ElementVector(nRow); elementVector = NEW ElementVector(nRow);
}
Element *el = elInfo->getElement(); Element *el = elInfo->getElement();
checkForNewTraverse(); checkForNewTraverse();
checkQuadratures(); checkQuadratures();
if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized()) { if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized()) {
initElement(elInfo); initElement(elInfo);
} }
if (el != lastVecEl || !operat->isOptimized()) { if (el != lastVecEl || !operat->isOptimized()) {
if (rememberElVec) { if (rememberElVec) {
...@@ -1426,9 +1424,7 @@ namespace AMDiS { ...@@ -1426,9 +1424,7 @@ namespace AMDiS {
return; return;
} }
} }
ElementVector *vec = rememberElVec ? elementVector : userVec; ElementVector *vec = rememberElVec ? elementVector : userVec;
if (operat->uhOld && remember) { if (operat->uhOld && remember) {
matVecAssemble(elInfo, vec); matVecAssemble(elInfo, vec);
if (rememberElVec) { if (rememberElVec) {
...@@ -1436,12 +1432,12 @@ namespace AMDiS { ...@@ -1436,12 +1432,12 @@ namespace AMDiS {
} }
return; return;
} }
if (firstOrderAssemblerGrdPsi) {
if (firstOrderAssemblerGrdPsi)
firstOrderAssemblerGrdPsi->calculateElementVector(elInfo, vec); firstOrderAssemblerGrdPsi->calculateElementVector(elInfo, vec);
if (zeroOrderAssembler) }
if (zeroOrderAssembler) {
zeroOrderAssembler->calculateElementVector(elInfo, vec); zeroOrderAssembler->calculateElementVector(elInfo, vec);
}
if (rememberElVec) { if (rememberElVec) {
axpy(factor, *elementVector, *userVec); axpy(factor, *elementVector, *userVec);
} }
......
...@@ -28,7 +28,7 @@ namespace AMDiS { ...@@ -28,7 +28,7 @@ namespace AMDiS {
nr0DOF(mesh->getDim(), NO_INIT) nr0DOF(mesh->getDim(), NO_INIT)
{ init(); } { init(); }
DOFAdmin::DOFAdmin(Mesh* m,::std::string aName) DOFAdmin::DOFAdmin(Mesh* m,std::string aName)
: name(aName), : name(aName),
mesh(m), mesh(m),
nrDOF(mesh->getDim(), NO_INIT), nrDOF(mesh->getDim(), NO_INIT),
...@@ -81,15 +81,15 @@ namespace AMDiS { ...@@ -81,15 +81,15 @@ namespace AMDiS {
TEST_EXIT_DBG(usedCount > 0)("no dofs in use\n"); TEST_EXIT_DBG(usedCount > 0)("no dofs in use\n");
TEST_EXIT_DBG((dof >= 0) && (dof < size))("invalid dof index %d\n",dof); TEST_EXIT_DBG((dof >= 0) && (dof < size))("invalid dof index %d\n",dof);
::std::list<DOFIndexedBase*>::iterator di; std::list<DOFIndexedBase*>::iterator di;
::std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for(di = dofIndexedList.begin(); di != end; ++di) { for(di = dofIndexedList.begin(); di != end; ++di) {
(*di)->freeDOFContent(dof); (*di)->freeDOFContent(dof);
} }
::std::list<DOFContainer*>::iterator dc; std::list<DOFContainer*>::iterator dc;
::std::list<DOFContainer*>::iterator dcend = dofContainerList.end(); std::list<DOFContainer*>::iterator dcend = dofContainerList.end();
for(dc = dofContainerList.begin(); dc != dcend; ++dc) { for(dc = dofContainerList.begin(); dc != dcend; ++dc) {
(*dc)->freeDOFIndex(dof); (*dc)->freeDOFIndex(dof);
...@@ -151,14 +151,13 @@ namespace AMDiS { ...@@ -151,14 +151,13 @@ namespace AMDiS {
void DOFAdmin::enlargeDOFLists(int minsize) void DOFAdmin::enlargeDOFLists(int minsize)
{ {
FUNCNAME("DOFAdmin::enlargeDOFLists"); FUNCNAME("DOFAdmin::enlargeDOFLists");
int old, newval; //, i, j;
old = size; int old = size;
if (minsize > 0) { if (minsize > 0) {
if (old > minsize) return; if (old > minsize) return;
} }
newval = max(minsize, static_cast<int>((dofFree.size() + sizeIncrement))); int newval = max(minsize, static_cast<int>((dofFree.size() + sizeIncrement)));
size = newval; size = newval;
...@@ -170,8 +169,8 @@ namespace AMDiS { ...@@ -170,8 +169,8 @@ namespace AMDiS {
// enlarge all vectors and matrices // enlarge all vectors and matrices
// but DOFVectors<int> don't have to be changed // but DOFVectors<int> don't have to be changed
::std::list<DOFIndexedBase*>::iterator di; std::list<DOFIndexedBase*>::iterator di;
::std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for (di = dofIndexedList.begin(); di != end; ++di) { for (di = dofIndexedList.begin(); di != end; ++di) {
if ((*di)->getSize() < newval) { if ((*di)->getSize() < newval) {
...@@ -195,8 +194,8 @@ namespace AMDiS { ...@@ -195,8 +194,8 @@ namespace AMDiS {
{ {
FUNCNAME("DOFAdmin::removeDOFIndexed()"); FUNCNAME("DOFAdmin::removeDOFIndexed()");
::std::list<DOFIndexedBase*>::iterator it; std::list<DOFIndexedBase*>::iterator it;
::std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for (it = dofIndexedList.begin(); it != end; ++it) { for (it = dofIndexedList.begin(); it != end; ++it) {
if (*it == dofIndexed) { if (*it == dofIndexed) {
dofIndexedList.erase(it); dofIndexedList.erase(it);
...@@ -218,8 +217,8 @@ namespace AMDiS { ...@@ -218,8 +217,8 @@ namespace AMDiS {
{ {
FUNCNAME("DOFAdmin::removeDOFContainer()"); FUNCNAME("DOFAdmin::removeDOFContainer()");
::std::list<DOFContainer*>::iterator it; std::list<DOFContainer*>::iterator it;
::std::list<DOFContainer*>::iterator end = dofContainerList.end(); std::list<DOFContainer*>::iterator end = dofContainerList.end();
for (it = dofContainerList.begin(); it != end; ++it) { for (it = dofContainerList.begin(); it != end; ++it) {
if (*it == cont) { if (*it == cont) {
dofContainerList.erase(it); dofContainerList.erase(it);
...@@ -232,10 +231,9 @@ namespace AMDiS { ...@@ -232,10 +231,9 @@ namespace AMDiS {
/****************************************************************************/ /****************************************************************************/
void DOFAdmin::compress(::std::vector<DegreeOfFreedom> &new_dof) void DOFAdmin::compress(std::vector<DegreeOfFreedom> &new_dof)
{ {
FUNCNAME("DOFAdmin::compress()"); FUNCNAME("DOFAdmin::compress()");
int i,n,first,last=0;
// nothing to do ? // nothing to do ?
if (size < 1) return; if (size < 1) return;
...@@ -243,16 +241,18 @@ namespace AMDiS { ...@@ -243,16 +241,18 @@ namespace AMDiS {
if (holeCount < 1) return; if (holeCount < 1) return;
// vector to mark used dofs // vector to mark used dofs
for(i=0; i < size; i++) { for (int i = 0; i < size; i++) {
new_dof[i] = -1; new_dof[i] = -1;
} }
// mark used dofs // mark used dofs
DOFIteratorBase it(this, USED_DOFS); DOFIteratorBase it(this, USED_DOFS);
for (it.reset(); !it.end(); ++it) new_dof[it.getDOFIndex()] = 1; for (it.reset(); !it.end(); ++it) {
new_dof[it.getDOFIndex()] = 1;
}
n = 0; int n = 0, last = 0;
for (i = 0; i < size; i++) { /* create a MONOTONE compress */ for (int i = 0; i < size; i++) { /* create a MONOTONE compress */
if (new_dof[i] == 1) { if (new_dof[i] == 1) {
new_dof[i] = n++; new_dof[i] = n++;
last = i; last = i;
...@@ -262,11 +262,11 @@ namespace AMDiS { ...@@ -262,11 +262,11 @@ namespace AMDiS {
TEST_EXIT_DBG(n == usedCount)("count %d != usedCount %d\n", n, usedCount); TEST_EXIT_DBG(n == usedCount)("count %d != usedCount %d\n", n, usedCount);
// mark used dofs in compressed dofFree // mark used dofs in compressed dofFree
for(i=0; i < n; i++) { for (int i = 0; i < n; i++) {
dofFree[i] = false; dofFree[i] = false;
} }
// mark unused dofs in compressed dofFree // mark unused dofs in compressed dofFree
for(i=n; i < size; i++) { for (int i = n; i < size; i++) {
dofFree[i] = true; dofFree[i] = true;
} }
...@@ -275,24 +275,24 @@ namespace AMDiS { ...@@ -275,24 +275,24 @@ namespace AMDiS {
sizeUsed = n; sizeUsed = n;
// get index of first changed dof // get index of first changed dof
first = last; int first = last;
for (i=0; i<size; i++) { for (int i = 0; i<size; i++) {
if ((new_dof[i] < i) && (new_dof[i] >= 0)) { if ((new_dof[i] < i) && (new_dof[i] >= 0)) {
first = i; first = i;
break; break;
} }
} }
::std::list<DOFIndexedBase*>::iterator di; std::list<DOFIndexedBase*>::iterator di;
::std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for(di = dofIndexedList.begin(); di != end; ++di) { for (di = dofIndexedList.begin(); di != end; ++di) {
(*di)->compressDOFIndexed(first, last, new_dof); (*di)->compressDOFIndexed(first, last, new_dof);
}; };
::std::list<DOFContainer*>::iterator dc; std::list<DOFContainer*>::iterator dc;
::std::list<DOFContainer*>::iterator endc = dofContainerList.end(); std::list<DOFContainer*>::iterator endc = dofContainerList.end();
for(dc = dofContainerList.begin(); dc != endc; dc++) { for (dc = dofContainerList.begin(); dc != endc; dc++) {
(*dc)->compressDOFContainer(n, new_dof); (*dc)->compressDOFContainer(n, new_dof);
}; };
...@@ -312,19 +312,17 @@ namespace AMDiS { ...@@ -312,19 +312,17 @@ namespace AMDiS {
} }
DOFAdmin::~DOFAdmin() DOFAdmin::~DOFAdmin()
{ {}
}
void DOFAdmin::serialize(::std::ostream &out) void DOFAdmin::serialize(std::ostream &out)
{ {
// write name // write name
out << name << ::std::endl; out << name << std::endl;
// write dofFree // write dofFree
int i;
int s = static_cast<int>(dofFree.size()); int s = static_cast<int>(dofFree.size());
out.write(reinterpret_cast<const char*>(&s), sizeof(int)); out.write(reinterpret_cast<const char*>(&s), sizeof(int));
for (i = 0; i < s; i++) { for (int i = 0; i < s; i++) {
bool free = dofFree[i]; bool free = dofFree[i];
out.write(reinterpret_cast<const char*>(&free), sizeof(bool)); out.write(reinterpret_cast<const char*>(&free), sizeof(bool));
} }
...@@ -351,18 +349,17 @@ namespace AMDiS { ...@@ -351,18 +349,17 @@ namespace AMDiS {
nr0DOF.serialize(out); nr0DOF.serialize(out);
} }
void DOFAdmin::deserialize(::std::istream &in) void DOFAdmin::deserialize(std::istream &in)
{ {
// read name // read name
in >> name; in >> name;
in.get(); in.get();
// read dofFree // read dofFree
int i;
int s; int s;
in.read(reinterpret_cast<char*>(&s), sizeof(int)); in.read(reinterpret_cast<char*>(&s), sizeof(int));
dofFree.resize(s); dofFree.resize(s);
for (i = 0; i < s; i++) { for (int i = 0; i < s; i++) {
bool free; bool free;
in.read(reinterpret_cast<char*>(&free), sizeof(bool)); in.read(reinterpret_cast<char*>(&free), sizeof(bool));
dofFree[i] = free; dofFree[i] = free;
...@@ -389,10 +386,10 @@ namespace AMDiS { ...@@ -389,10 +386,10 @@ namespace AMDiS {
// read nr0DOF // read nr0DOF
nr0DOF.deserialize(in); nr0DOF.deserialize(in);
::std::list<DOFIndexedBase*>::iterator di; std::list<DOFIndexedBase*>::iterator di;
::std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end();
for(di = dofIndexedList.begin(); di != end; ++di) { for (di = dofIndexedList.begin(); di != end; ++di) {
(*di)->resize(size); (*di)->resize(size);
} }
} }
......
...@@ -756,14 +756,13 @@ namespace AMDiS { ...@@ -756,14 +756,13 @@ namespace AMDiS {
} else { } else {
::std::vector<Operator*>::iterator it; ::std::vector<Operator*>::iterator it;
::std::vector<double*>::iterator factorIt; ::std::vector<double*>::iterator factorIt;
for(it = this->operators.begin(), factorIt = this->operatorFactor.begin(); for (it = this->operators.begin(), factorIt = this->operatorFactor.begin();
it != this->operators.end(); it != this->operators.end();
++it, ++factorIt) ++it, ++factorIt) {
{ (*it)->getElementVector(elInfo,
(*it)->getElementVector(elInfo, this->elementVector,
this->elementVector, *factorIt ? **factorIt : 1.0);
*factorIt ? **factorIt : 1.0); }
}
} }
addElementVector(factor, addElementVector(factor,
......
...@@ -51,7 +51,8 @@ namespace AMDiS { ...@@ -51,7 +51,8 @@ namespace AMDiS {
ProblemScal *prob, ProblemScal *prob,
ProblemStatBase *initialProb) ProblemStatBase *initialProb)
: ProblemInstat(name_, initialProb), : ProblemInstat(name_, initialProb),
problemStat(prob),oldSolution(NULL) problemStat(prob),
oldSolution(NULL)
{}; {};
...@@ -119,7 +120,8 @@ namespace AMDiS { ...@@ -119,7 +120,8 @@ namespace AMDiS {
ProblemVec *prob, ProblemVec *prob,
ProblemStatBase *initialProb) ProblemStatBase *initialProb)
: ProblemInstat(name_, initialProb), : ProblemInstat(name_, initialProb),
problemStat(prob),oldSolution(NULL) problemStat(prob),
oldSolution(NULL)
{}; {};
ProblemInstatVec::~ProblemInstatVec() ProblemInstatVec::~ProblemInstatVec()
...@@ -150,8 +152,8 @@ namespace AMDiS { ...@@ -150,8 +152,8 @@ namespace AMDiS {
} }
} }
if(!oldSolution) WARNING("no oldSolution created\n"); if (!oldSolution)
WARNING("no oldSolution created\n");
} }
void ProblemInstatVec::createUhOld() { void ProblemInstatVec::createUhOld() {
......
...@@ -585,7 +585,6 @@ namespace AMDiS { ...@@ -585,7 +585,6 @@ namespace AMDiS {
rhs_->set(0.0); rhs_->set(0.0);
traversePtr_ = this; traversePtr_ = this;
mesh_->traverse(-1, assembleFlag, &buildAfterCoarsenFct); mesh_->traverse(-1, assembleFlag, &buildAfterCoarsenFct);
// fill boundary conditions // fill boundary conditions
...@@ -633,10 +632,11 @@ namespace AMDiS { ...@@ -633,10 +632,11 @@ namespace AMDiS {
{ {
const BoundaryType *bound; const BoundaryType *bound;
if (traversePtr_->getBoundUsed()) if (traversePtr_->getBoundUsed()) {
bound = traversePtr_->getFESpace()->getBasisFcts()->getBound(elInfo, NULL); bound = traversePtr_->getFESpace()->getBasisFcts()->getBound(elInfo, NULL);
else } else {
bound = NULL; bound = NULL;
}
traversePtr_->getSystemMatrix()->assemble(1.0, elInfo, bound); traversePtr_->getSystemMatrix()->assemble(1.0, elInfo, bound);
traversePtr_->getRHS()->assemble(1.0, elInfo, bound); traversePtr_->getRHS()->assemble(1.0, elInfo, bound);
......
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