Commit d8a17f14 authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed Lumped preconditioner issue.

parent 82a26536
......@@ -23,9 +23,9 @@ namespace AMDiS {
{
FUNCNAME("DofToMatIndex::getReverse()");
for (map<int, map<DegreeOfFreedom, int> >::iterator it0 = data.begin();
for (map<int, boost::container::flat_map<DegreeOfFreedom, int> >::iterator it0 = data.begin();
it0 != data.end(); ++it0)
for (map<DegreeOfFreedom, int>::iterator it1 = it0->second.begin();
for (boost::container::flat_map<DegreeOfFreedom, int>::iterator it1 = it0->second.begin();
it1 != it0->second.end(); ++it1)
if (it1->second == rowIndex) {
component = it0->first;
......
......@@ -29,6 +29,8 @@
#include <set>
#include <petsc.h>
#include <petscis.h>
#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>
#include "AMDiS_fwd.h"
#include "parallel/DofComm.h"
......@@ -92,7 +94,8 @@ namespace AMDiS {
private:
/// The mapping data. For each system component there is a specific map that
/// maps global DOF indices to global matrix indices.
map<int, map<DegreeOfFreedom, int> > data;
// map<int, map<DegreeOfFreedom, int> > data;
map<int, boost::container::flat_map<DegreeOfFreedom, int> > data;
};
......@@ -273,7 +276,7 @@ namespace AMDiS {
DofMap dofMap;
/// Set of all DOFs that are in mapping but are not owned by the rank.
std::set<DegreeOfFreedom> nonRankDofs;
boost::container::flat_set<DegreeOfFreedom> nonRankDofs;
/// If true, a global index mapping will be computed for all DOFs.
bool needGlobalMapping;
......
......@@ -23,6 +23,7 @@
#include <vector>
#include <set>
#include <map>
#include <boost/container/flat_map.hpp>
#include "BoundaryObject.h"
#include "Global.h"
#include "parallel/InteriorBoundary.h"
......@@ -72,7 +73,8 @@ namespace AMDiS {
int local, global;
};
typedef std::map<DegreeOfFreedom, MultiIndex> DofMap;
// typedef std::map<DegreeOfFreedom, MultiIndex> DofMap;
typedef boost::container::flat_map<DegreeOfFreedom, MultiIndex> DofMap;
typedef vector<MeshStructure> MeshCodeVec;
......
......@@ -1395,7 +1395,7 @@ namespace AMDiS {
{
FUNCNAME("PetscSolverFeti::createPreconditionerMatrix()");
if (fetiPreconditioner != FETI_NONE)
if (fetiPreconditioner == FETI_NONE)
return;
double wtime = MPI::Wtime();
......@@ -1460,6 +1460,9 @@ namespace AMDiS {
const FiniteElemSpace *rowFeSpace = feSpaces[rowComponent];
const FiniteElemSpace *colFeSpace = feSpaces[colComponent];
if (enableStokesMode && (rowFeSpace == fullInterface || colFeSpace == fullInterface))
continue;
traits::col<Matrix>::type col(dofMat->getBaseMatrix());
traits::const_value<Matrix>::type value(dofMat->getBaseMatrix());
......@@ -1469,51 +1472,49 @@ namespace AMDiS {
if (isPrimal(rowFeSpace, *cursor))
continue;
colsLocal.clear();
colsLocalOther.clear();
valuesLocal.clear();
valuesLocalOther.clear();
// Traverse all columns.
for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor);
icursor != icend; ++icursor) {
if (isPrimal(colFeSpace, col(*icursor)))
continue;
if (!isDual(rowFeSpace, *cursor)) {
if (!isDual(colFeSpace, col(*icursor))) {
int colIndex =
interiorDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocal.push_back(colIndex);
valuesLocal.push_back(value(*icursor));
} else {
int colIndex =
dualDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocalOther.push_back(colIndex);
valuesLocalOther.push_back(value(*icursor));
}
} else {
if (!isDual(colFeSpace, col(*icursor))) {
int colIndex =
interiorDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocalOther.push_back(colIndex);
valuesLocalOther.push_back(value(*icursor));
} else {
int colIndex =
dualDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocal.push_back(colIndex);
valuesLocal.push_back(value(*icursor));
}
}
} // for each nnz in row
// === Set matrix values for preconditioner ===
switch (fetiPreconditioner) {
case FETI_DIRICHLET:
colsLocal.clear();
colsLocalOther.clear();
valuesLocal.clear();
valuesLocalOther.clear();
// Traverse all columns.
for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor);
icursor != icend; ++icursor) {
if (isPrimal(colFeSpace, col(*icursor)))
continue;
if (!isDual(rowFeSpace, *cursor)) {
if (!isDual(colFeSpace, col(*icursor))) {
int colIndex =
interiorDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocal.push_back(colIndex);
valuesLocal.push_back(value(*icursor));
} else {
int colIndex =
dualDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocalOther.push_back(colIndex);
valuesLocalOther.push_back(value(*icursor));
}
} else {
if (!isDual(colFeSpace, col(*icursor))) {
int colIndex =
interiorDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocalOther.push_back(colIndex);
valuesLocalOther.push_back(value(*icursor));
} else {
int colIndex =
dualDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocal.push_back(colIndex);
valuesLocal.push_back(value(*icursor));
}
}
} // for each nnz in row
if (!isDual(rowFeSpace, *cursor)) {
int rowIndex =
interiorDofMap.getLocalMatIndex(rowComponent, *cursor);
......@@ -1532,18 +1533,38 @@ namespace AMDiS {
MatSetValues(mat_duals_interior, 1, &rowIndex, colsLocalOther.size(),
&(colsLocalOther[0]), &(valuesLocalOther[0]), INSERT_VALUES);
}
break;
case FETI_LUMPED:
if (isDual(rowFeSpace, *cursor)) {
int rowIndex = dualDofMap.getLocalMatIndex(rowComponent, *cursor);
MatSetValues(mat_duals_duals, 1, &rowIndex, colsLocal.size(),
&(colsLocal[0]), &(valuesLocal[0]), INSERT_VALUES);
}
if (!isDual(rowFeSpace, *cursor))
continue;
colsLocal.clear();
valuesLocal.clear();
// Traverse all columns.
for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor);
icursor != icend; ++icursor) {
if (!isDual(colFeSpace, col(*icursor)))
continue;
int colIndex =
dualDofMap.getLocalMatIndex(colComponent, col(*icursor));
colsLocal.push_back(colIndex);
valuesLocal.push_back(value(*icursor));
}
int rowIndex = dualDofMap.getLocalMatIndex(rowComponent, *cursor);
MatSetValues(mat_duals_duals, 1, &rowIndex, colsLocal.size(),
&(colsLocal[0]), &(valuesLocal[0]), INSERT_VALUES);
break;
default:
break;
}
}
}
}
}
......
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