Commit 42237fb0 authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed some bugs.

parent 83c8b38d
......@@ -104,6 +104,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/Line.cc
${SOURCE_DIR}/MacroElement.cc
${SOURCE_DIR}/Marker.cc
${SOURCE_DIR}/MatrixVector.cc
${SOURCE_DIR}/Mesh.cc
${SOURCE_DIR}/MeshStructure.cc
${SOURCE_DIR}/Operator.cc
......
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.
#include "MatrixVector.h"
#include "FiniteElemSpace.h"
#include "DOFMatrix.h"
namespace AMDiS {
vector<const FiniteElemSpace*> getFeSpaces(Matrix<DOFMatrix*> &mat)
{
FUNCNAME("getFeSpaces()");
int nComponents = mat.getNumRows();
vector<const FiniteElemSpace*> result(nComponents);
for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++) {
if (mat[i][j]) {
result[i] = mat[i][j]->getRowFeSpace();
break;
}
}
}
return result;
}
}
......@@ -518,6 +518,10 @@ namespace AMDiS {
z[2] = x[0] * y[1] - x[1] * y[0];
}
/// Returns a vector with the FE spaces of each row in the matrix. Thus, the
/// resulting vector may contain the same FE space multiple times.
vector<const FiniteElemSpace*> getFeSpaces(Matrix<DOFMatrix*> &mat);
}
#endif // AMDIS_MATRIXVECTOR_H
......@@ -89,7 +89,7 @@ namespace AMDiS {
int nMat = uniqueCoarseMap.size() + 1;
nnz.resize(nMat);
for (int i = 0; i < nMat; i++) {
nnz.resize(nMat);
nnz[i].resize(nMat);
for (int j = 0; j < nMat; j++)
nnz[i][j].clear();
}
......@@ -105,13 +105,15 @@ namespace AMDiS {
continue;
if (i == j) {
nnz[i][j].create(seqMat, mpiCommGlobal, coarseSpaceMap, NULL,
nnz[i][j].create(seqMat, mpiCommGlobal, *(coarseSpaceMap[i - 1]), NULL,
meshDistributor->getElementObjectDb());
} else {
ParallelDofMapping *rowMap = NULL;
ParallelDofMapping *colMap = NULL;
nnz[i][j].create(seqMat, mpiCommGlobal, *rowMap, *colMap, NULL,
ParallelDofMapping &rowMap =
(i == 0 ? *interiorMap : *(coarseSpaceMap[i - 1]));
ParallelDofMapping &colMap =
(j == 0 ? *interiorMap : *(coarseSpaceMap[j - 1]));
nnz[i][j].create(seqMat, mpiCommGlobal, rowMap, colMap, NULL,
meshDistributor->getElementObjectDb());
/*
......
......@@ -27,6 +27,7 @@
#include <map>
#include <petsc.h>
#include "AMDiS_fwd.h"
#include "parallel/MatrixNnzStructure.h"
namespace AMDiS {
......
......@@ -135,30 +135,6 @@ namespace AMDiS {
}
vector<const FiniteElemSpace*> PetscSolver::getFeSpaces(Matrix<DOFMatrix*> *mat)
{
FUNCNAME("PetscSolver::getFeSpaces()");
int nComponents = mat->getNumRows();
vector<const FiniteElemSpace*> result(nComponents);
for (int i = 0; i < nComponents; i++)
for (int j = 0; j < nComponents; j++)
if ((*mat)[i][j]) {
result[i] = (*mat)[i][j]->getRowFeSpace();
break;
}
#if (DEBUG != 0)
// === In debug mode, we test if all FE spaces of the matrix are also ===
// === considered by the mesh distributor. ===
checkFeSpaces(result);
#endif
return result;
}
vector<const FiniteElemSpace*> PetscSolver::getFeSpaces(SystemVector *vec)
{
FUNCNAME("PetscSolver::getFeSpaces()");
......
......@@ -229,10 +229,6 @@ namespace AMDiS {
/// Checks if all given FE spaces are handled by the mesh distributor.
void checkFeSpaces(vector<const FiniteElemSpace*>& feSpaces);
/// Returns a vector with the FE spaces of each row in the matrix. Thus, the
/// resulting vector may contain the same FE space multiple times.
vector<const FiniteElemSpace*> getFeSpaces(Matrix<DOFMatrix*> *mat);
/// Returns a vector with the FE spaces of all components of a system vector.
vector<const FiniteElemSpace*> getFeSpaces(SystemVector *vec);
......
......@@ -11,6 +11,7 @@
#include "AMDiS.h"
#include "MatrixVector.h"
#include "parallel/PetscSolverFeti.h"
#include "parallel/PetscSolverFetiStructs.h"
#include "parallel/StdMpi.h"
......@@ -1351,7 +1352,7 @@ namespace AMDiS {
// === Create all sets and indices. ===
vector<const FiniteElemSpace*> feSpaces = getFeSpaces(mat);
vector<const FiniteElemSpace*> feSpaces = AMDiS::getFeSpaces(*mat);
initialize(feSpaces);
......
......@@ -24,7 +24,7 @@ namespace AMDiS {
petscData.init(interiorMap, coarseSpaceMap,
subdomainLevel, mpiCommLocal, mpiCommGlobal,
meshDistributor);
petscData.create();
petscData.create(*seqMat);
if (coarseSpaceMap.size()) {
updateSubdomainData();
......@@ -130,7 +130,7 @@ namespace AMDiS {
TEST_EXIT_DBG(coarseSpaceMap.size() == seqMat->getSize())
("Wrong sizes %d %d\n", coarseSpaceMap.size(), seqMat->getSize());
vector<const FiniteElemSpace*> feSpaces = getFeSpaces(seqMat);
vector<const FiniteElemSpace*> feSpaces = AMDiS::getFeSpaces(*seqMat);
int nRowsRankInterior = interiorMap->getRankDofs();
int nRowsOverallInterior = interiorMap->getOverallDofs();
......
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