Commit 807e9d57 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Bug fix

parent a9ba2f66
...@@ -377,22 +377,19 @@ namespace AMDiS { ...@@ -377,22 +377,19 @@ namespace AMDiS {
void DOFMatrix::compressDOFIndexed(int first, int last, void DOFMatrix::compressDOFIndexed(int first, int last,
std::vector<DegreeOfFreedom> &newDOF) std::vector<DegreeOfFreedom> &newDOF)
{ {
int i, j, k, col; for (int i = first; i <= last; i++) {
std::vector<MatEntry> *row; if (newDOF[i] >= 0) {
matrix[newDOF[i]].swap(matrix[i]);
for(i = first; i <= last; i++) {
if((k = newDOF[i]) >= 0) {
matrix[k].swap(matrix[i]);
matrix[i].resize(0); matrix[i].resize(0);
} }
} }
int usedSize = rowFESpace->getAdmin()->getUsedSize(); int usedSize = rowFESpace->getAdmin()->getUsedSize();
for (i = 0; i < usedSize; i++) { for (int i = 0; i < usedSize; i++) {
row = reinterpret_cast< std::vector<MatEntry>*>(&(matrix[i])); std::vector<MatEntry> *row = reinterpret_cast<std::vector<MatEntry>*>(&(matrix[i]));
int rowSize = static_cast<int>(row->size()); int rowSize = static_cast<int>(row->size());
for (j = 0; j < rowSize; j++) { for (int j = 0; j < rowSize; j++) {
col = (*row)[j].col; int col = (*row)[j].col;
if (entryUsed(i,j)) if (entryUsed(i, j))
(*row)[j].col = newDOF[col]; (*row)[j].col = newDOF[col];
} }
} }
...@@ -403,6 +400,8 @@ namespace AMDiS { ...@@ -403,6 +400,8 @@ namespace AMDiS {
int col = 0; int col = 0;
if (0 < matrix[index].size()) { if (0 < matrix[index].size()) {
int nRows = matrix.size();
// for all columns in this row // for all columns in this row
int size = static_cast<int>(matrix[index].size()); int size = static_cast<int>(matrix[index].size());
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
...@@ -410,7 +409,7 @@ namespace AMDiS { ...@@ -410,7 +409,7 @@ namespace AMDiS {
if (entryUsed(index, i)) { if (entryUsed(index, i)) {
// get column of this entry // get column of this entry
col = matrix[index][i].col; col = matrix[index][i].col;
if (col != index) { // remove symmetric entry if exists if ((col != index) && (col < nRows)) { // remove symmetric entry if exists
int colsize = static_cast<int>(matrix[col].size()); int colsize = static_cast<int>(matrix[col].size());
for (int j = 0; j < colsize; j++) { for (int j = 0; j < colsize; j++) {
int col2 = matrix[col][j].col; int col2 = matrix[col][j].col;
......
...@@ -260,14 +260,14 @@ namespace AMDiS { ...@@ -260,14 +260,14 @@ namespace AMDiS {
/** \brief /** \brief
* Returns whether entry matrix[a][b] is used * Returns whether entry matrix[a][b] is used
*/ */
inline bool entryUsed(DegreeOfFreedom a,int b) const { inline bool entryUsed(DegreeOfFreedom a, int b) const {
return (((matrix[a])[b]).col >= 0); return (((matrix[a])[b]).col >= 0);
} }
/** \brief /** \brief
* Returns true if matrix[a][b] has entry \ref NO_MORE_ENTRIES * Returns true if matrix[a][b] has entry \ref NO_MORE_ENTRIES
*/ */
inline bool noMoreEntries(DegreeOfFreedom a,int b) const { inline bool noMoreEntries(DegreeOfFreedom a, int b) const {
return (NO_MORE_ENTRIES == ((matrix[a])[b]).col); return (NO_MORE_ENTRIES == ((matrix[a])[b]).col);
} }
...@@ -548,7 +548,7 @@ namespace AMDiS { ...@@ -548,7 +548,7 @@ namespace AMDiS {
return NULL; return NULL;
if (it->col == jcol) if (it->col == jcol)
return &(it->entry); return &(it->entry);
}; }
return NULL; return NULL;
} }
......
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