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

* Addition of DOFMatrices

parent 3236301f
......@@ -125,7 +125,6 @@ namespace AMDiS {
for (int i = 0; i < mSize; i++) {
matrix[i].resize(0);
}
return;
}
bool DOFMatrix::symmetric()
......@@ -772,4 +771,47 @@ namespace AMDiS {
return(result);
}
void addDOFMatrix(DOFMatrix *result, const DOFMatrix *a, const DOFMatrix *b)
{
result->clear();
DOFMatrix::Iterator resultIterator(result, USED_DOFS);
DOFMatrix::Iterator aIterator(const_cast<DOFMatrix*>(a), USED_DOFS);
DOFMatrix::Iterator bIterator(const_cast<DOFMatrix*>(b), USED_DOFS);
for (resultIterator.reset(), aIterator.reset();
!aIterator.end();
++resultIterator, ++aIterator) {
*resultIterator = *aIterator;
}
for (resultIterator.reset(), bIterator.reset();
!bIterator.end();
++resultIterator, ++bIterator) {
std::vector<MatEntry>::iterator resultRowIt;
std::vector<MatEntry>::const_iterator bRowIt;
for (bRowIt = bIterator->begin();
bRowIt != bIterator->end();
++bRowIt) {
bool added = false;
for (resultRowIt = resultIterator->begin();
resultRowIt != resultIterator->end();
++resultRowIt) {
if (bRowIt->col == resultRowIt->col) {
resultRowIt->entry += bRowIt->entry;
added = true;
break;
}
}
if (!added) {
resultIterator->push_back(*bRowIt);
}
}
}
}
}
......@@ -739,6 +739,8 @@ namespace AMDiS {
double max(std::vector<MatEntry> *row);
void addDOFMatrix(DOFMatrix *result, const DOFMatrix *a, const DOFMatrix *b);
}
#endif // AMDIS_DOFMATRIX_H
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