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

* Deleted directory AMDiS/src/AMDiS

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