Skip to content
Snippets Groups Projects
Commit 78b07366 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

New algorithm for periodic boundary conditions. First time without errors, but very inefficient.

parent e6efd667
No related branches found
No related tags found
No related merge requests found
...@@ -240,8 +240,6 @@ namespace AMDiS { ...@@ -240,8 +240,6 @@ namespace AMDiS {
for (int j = 0; j < nCol; j++) { for (int j = 0; j < nCol; j++) {
DegreeOfFreedom col = colIndices[j]; DegreeOfFreedom col = colIndices[j];
ins[row][col] += elMat[i][j]; ins[row][col] += elMat[i][j];
// MSG("El %d DOFs %d %d value %f\n", rowElInfo->getElement()->getIndex(), row, col, elMat[i][j]);
} }
} }
} }
......
...@@ -146,10 +146,6 @@ namespace AMDiS { ...@@ -146,10 +146,6 @@ namespace AMDiS {
// Calculate the exact position of the column index in the petsc matrix. // Calculate the exact position of the column index in the petsc matrix.
int colIndex = globalColDof * dispMult + dispAddCol; int colIndex = globalColDof * dispMult + dispAddCol;
MatSetValue(petscMatrix, rowIndex, colIndex, value(*icursor), ADD_VALUES); MatSetValue(petscMatrix, rowIndex, colIndex, value(*icursor), ADD_VALUES);
if (rowIndex == 0 && colIndex == 0) {
MSG("ADDED-C ON ZERO: %f (with no scal)\n", value(*icursor));
}
} else { } else {
std::set<int>& perColAsc = meshDistributor->getPerDofAssociations(globalColDof); std::set<int>& perColAsc = meshDistributor->getPerDofAssociations(globalColDof);
std::set<int> perAsc; std::set<int> perAsc;
...@@ -173,9 +169,6 @@ namespace AMDiS { ...@@ -173,9 +169,6 @@ namespace AMDiS {
for (int i = 0; i < newCols.size(); i++) { for (int i = 0; i < newCols.size(); i++) {
int colIndex = newCols[i] * dispMult + dispAddCol; int colIndex = newCols[i] * dispMult + dispAddCol;
MatSetValue(petscMatrix, rowIndex, colIndex, scaledValue, ADD_VALUES); MatSetValue(petscMatrix, rowIndex, colIndex, scaledValue, ADD_VALUES);
if (rowIndex == 0 && colIndex == 0) {
MSG("ADDED-B ON ZERO: %f (with scal %f)\n", scaledValue, std::pow(0.5, static_cast<double>(perAsc.size())));
}
} }
} }
} }
...@@ -204,41 +197,28 @@ namespace AMDiS { ...@@ -204,41 +197,28 @@ namespace AMDiS {
for (std::set<int>::iterator it = perAsc.begin(); it != perAsc.end(); ++it) { for (std::set<int>::iterator it = perAsc.begin(); it != perAsc.end(); ++it) {
int nEntry = static_cast<int>(entry.size()); int nEntry = static_cast<int>(entry.size());
for (int i = 0; i < nEntry; i++) { for (int i = 0; i < nEntry; i++) {
// TEST_EXIT(overallDofMap[*it].count(entry[i].first) > 0) int perRowDof = 0;
// ("Should not happen A: %d %d\n", *it, entry[i].first);
// TEST_EXIT(overallDofMap[*it].count(entry[i].second) > 0)
// ("Should not happen B: %d %d\n", *it, entry[i].second);
int rd;
if (overallDofMap[*it].count(entry[i].first) > 0) if (overallDofMap[*it].count(entry[i].first) > 0)
rd = overallDofMap[*it][entry[i].first]; perRowDof = overallDofMap[*it][entry[i].first];
else else
rd = entry[i].first; perRowDof = entry[i].first;
int cd; int perColDof;
if (overallDofMap[*it].count(entry[i].second) > 0) if (overallDofMap[*it].count(entry[i].second) > 0)
cd = overallDofMap[*it][entry[i].second]; perColDof = overallDofMap[*it][entry[i].second];
else else
cd = entry[i].second; perColDof = entry[i].second;
entry.push_back(std::make_pair(rd, cd)); entry.push_back(std::make_pair(perRowDof, perColDof));
} }
} }
int ccc = 0; for (std::vector<std::pair<int, int> >::iterator eIt = entry.begin();
for (std::vector<std::pair<int, int> >::iterator eIt = entry.begin(); eIt != entry.end(); ++eIt) { eIt != entry.end(); ++eIt) {
// Calculate petsc row index. // Calculate petsc row index.
int rowIndex = eIt->first * dispMult + dispAddRow; int rowIndex = eIt->first * dispMult + dispAddRow;
int colIndex = eIt->second * dispMult + dispAddCol; int colIndex = eIt->second * dispMult + dispAddCol;
MatSetValue(petscMatrix, rowIndex, colIndex, scaledValue, ADD_VALUES); MatSetValue(petscMatrix, rowIndex, colIndex, scaledValue, ADD_VALUES);
if (rowIndex == 0 && colIndex == 0) {
MSG("ADDED-A ON ZERO: %f (with scal %f not scaled %f) org DOF/COL: %d %d TEST %d\n",
scaledValue, std::pow(0.5, static_cast<double>(perAsc.size())), value(*icursor),
globalRowDof, globalColDof, ccc);
}
ccc++;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment