Commit 56139ea6 authored by Thomas Witkowski's avatar Thomas Witkowski

bo eh

parent 576bb4eb
......@@ -114,11 +114,7 @@ namespace AMDiS {
bool localMatrix = (coarseSpaceMap.size() && subdomainLevel == 0);
if (checkMeshChange()) {
// Mesh has been changed, recompute interior DOF mapping.
interiorMap->setComputeMatIndex(!localMatrix);
interiorMap->update();
int nMat = uniqueCoarseMap.size() + 1;
int nMat = uniqueCoarseMap.size() + 1;
nnz.resize(nMat);
for (int i = 0; i < nMat; i++) {
nnz[i].resize(nMat);
......
......@@ -215,7 +215,8 @@ namespace AMDiS {
nRankDofs(1),
nLocalDofs(1),
nOverallDofs(1),
rStartDofs(1)
rStartDofs(1),
mode(mode)
{
switch (mode) {
case COMPONENT_WISE:
......@@ -535,4 +536,15 @@ namespace AMDiS {
ISCreateStride(mpiComm, nRankRows, firstMatIndex, 1, &is);
}
void ParallelDofMapping::printInfo()
{
FUNCNAME("ParallelDofMapping::printInfo()");
if (mode == COMPONENT_WISE) {
MSG("Mapping is defined by component numbers!\n");
} else {
MSG("Mapping is defined by FE spaces!\n");
}
}
}
......@@ -820,6 +820,10 @@ namespace AMDiS {
VecCreateSeq(PETSC_COMM_SELF, getRankDofs(), &vec);
}
/// Prints out some information about the mapping. May be used during
/// debugging or parallel solver creation.
void printInfo();
protected:
/// Compute \ref nRankDofs.
int computeRankDofs();
......@@ -883,6 +887,10 @@ namespace AMDiS {
/// Set of unique FE spaces.
vector<const FiniteElemSpace*> feSpaces;
/// Defines the DOF mapping either. The mapping may be defined either for
/// FE spaces or for component numbers.
DofMappingMode mode;
};
}
......
......@@ -45,7 +45,8 @@ namespace AMDiS {
void PetscSolver::init(vector<const FiniteElemSpace*> &fe0,
vector<const FiniteElemSpace*> &fe1)
vector<const FiniteElemSpace*> &fe1,
bool createGlobalMapping)
{
FUNCNAME("PetscSolver::init()");
......@@ -60,18 +61,20 @@ namespace AMDiS {
int nLevels = levelData.getLevelNumber();
TEST_EXIT_DBG(nLevels >= 1)("Should not happen!\n");
dofMap.init(levelData, componentSpaces, feSpaces);
dofMap.setMpiComm(levelData.getMpiComm(0), 0);
dofMap.setDofComm(meshDistributor->getDofComm());
dofMap.clear();
meshDistributor->registerDofMap(dofMap);
if (nLevels > 1) {
dofMapSd.init(levelData, componentSpaces, feSpaces);
dofMapSd.setMpiComm(levelData.getMpiComm(1), 1);
dofMapSd.setDofComm(meshDistributor->getDofCommSd());
dofMapSd.clear();
meshDistributor->registerDofMap(dofMapSd);
if (createGlobalMapping) {
dofMap.init(levelData, componentSpaces, feSpaces);
dofMap.setMpiComm(levelData.getMpiComm(0), 0);
dofMap.setDofComm(meshDistributor->getDofComm());
dofMap.clear();
meshDistributor->registerDofMap(dofMap);
if (nLevels > 1) {
dofMapSd.init(levelData, componentSpaces, feSpaces);
dofMapSd.setMpiComm(levelData.getMpiComm(1), 1);
dofMapSd.setDofComm(meshDistributor->getDofCommSd());
dofMapSd.clear();
meshDistributor->registerDofMap(dofMapSd);
}
}
}
......
......@@ -54,8 +54,9 @@ namespace AMDiS {
virtual ~PetscSolver() {}
virtual void init(vector<const FiniteElemSpace*> &componentSpaces,
vector<const FiniteElemSpace*> &feSpaces);
void init(vector<const FiniteElemSpace*> &componentSpaces,
vector<const FiniteElemSpace*> &feSpaces,
bool createGlobalMapping = true);
/** \brief
* Create a PETSc matrix. The given DOF matrices are used to create the nnz
......
......@@ -1282,20 +1282,28 @@ namespace AMDiS {
if (!massMatrixSolver) {
MSG("START CREATE MASS MATRIX!\n");
ParallelDofMapping *massMapping = new ParallelDofMapping(COMPONENT_WISE);
massMapping->init(meshDistributor->getMeshLevelData(),
pressureFeSpace, pressureFeSpace);
massMapping->setDofComm(meshDistributor->getDofComm());
(*massMapping)[0] = interfaceDofMap[pressureComponent];
massMapping->update();
DOFMatrix massMatrix(pressureFeSpace, pressureFeSpace);
Operator op(pressureFeSpace, pressureFeSpace);
Simple_ZOT zot;
op.addTerm(&zot);
massMatrix.assembleOperator(op);
ParallelDofMapping massMatMapping = interfaceDofMap;
massMatrixSolver = new PetscSolverGlobalMatrix;
massMatrixSolver->setKspPrefix("mass_");
massMatrixSolver->setMeshDistributor(meshDistributor,
mpiCommGlobal,
mpiCommLocal);
massMatrixSolver->setDofMapping(&massMatMapping);
massMatrixSolver->setDofMapping(massMapping);
MSG("START ASM ===\n");
massMatrixSolver->fillPetscMatrix(&massMatrix);
MSG("END ASM ===\n");
int r, c;
MatGetSize(massMatrixSolver->getMatInterior(), &r, &c);
......
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