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 ...@@ -104,6 +104,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/Line.cc ${SOURCE_DIR}/Line.cc
${SOURCE_DIR}/MacroElement.cc ${SOURCE_DIR}/MacroElement.cc
${SOURCE_DIR}/Marker.cc ${SOURCE_DIR}/Marker.cc
${SOURCE_DIR}/MatrixVector.cc
${SOURCE_DIR}/Mesh.cc ${SOURCE_DIR}/Mesh.cc
${SOURCE_DIR}/MeshStructure.cc ${SOURCE_DIR}/MeshStructure.cc
${SOURCE_DIR}/Operator.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 { ...@@ -518,6 +518,10 @@ namespace AMDiS {
z[2] = x[0] * y[1] - x[1] * y[0]; 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 #endif // AMDIS_MATRIXVECTOR_H
...@@ -89,7 +89,7 @@ namespace AMDiS { ...@@ -89,7 +89,7 @@ namespace AMDiS {
int nMat = uniqueCoarseMap.size() + 1; int nMat = uniqueCoarseMap.size() + 1;
nnz.resize(nMat); nnz.resize(nMat);
for (int i = 0; i < nMat; i++) { for (int i = 0; i < nMat; i++) {
nnz.resize(nMat); nnz[i].resize(nMat);
for (int j = 0; j < nMat; j++) for (int j = 0; j < nMat; j++)
nnz[i][j].clear(); nnz[i][j].clear();
} }
...@@ -105,13 +105,15 @@ namespace AMDiS { ...@@ -105,13 +105,15 @@ namespace AMDiS {
continue; continue;
if (i == j) { if (i == j) {
nnz[i][j].create(seqMat, mpiCommGlobal, coarseSpaceMap, NULL, nnz[i][j].create(seqMat, mpiCommGlobal, *(coarseSpaceMap[i - 1]), NULL,
meshDistributor->getElementObjectDb()); meshDistributor->getElementObjectDb());
} else { } else {
ParallelDofMapping *rowMap = NULL; ParallelDofMapping &rowMap =
ParallelDofMapping *colMap = NULL; (i == 0 ? *interiorMap : *(coarseSpaceMap[i - 1]));
ParallelDofMapping &colMap =
nnz[i][j].create(seqMat, mpiCommGlobal, *rowMap, *colMap, NULL, (j == 0 ? *interiorMap : *(coarseSpaceMap[j - 1]));
nnz[i][j].create(seqMat, mpiCommGlobal, rowMap, colMap, NULL,
meshDistributor->getElementObjectDb()); meshDistributor->getElementObjectDb());
/* /*
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <map> #include <map>
#include <petsc.h> #include <petsc.h>
#include "AMDiS_fwd.h" #include "AMDiS_fwd.h"
#include "parallel/MatrixNnzStructure.h"
namespace AMDiS { namespace AMDiS {
......
...@@ -135,30 +135,6 @@ 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) vector<const FiniteElemSpace*> PetscSolver::getFeSpaces(SystemVector *vec)
{ {
FUNCNAME("PetscSolver::getFeSpaces()"); FUNCNAME("PetscSolver::getFeSpaces()");
......
...@@ -229,10 +229,6 @@ namespace AMDiS { ...@@ -229,10 +229,6 @@ namespace AMDiS {
/// Checks if all given FE spaces are handled by the mesh distributor. /// Checks if all given FE spaces are handled by the mesh distributor.
void checkFeSpaces(vector<const FiniteElemSpace*>& feSpaces); 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. /// Returns a vector with the FE spaces of all components of a system vector.
vector<const FiniteElemSpace*> getFeSpaces(SystemVector *vec); vector<const FiniteElemSpace*> getFeSpaces(SystemVector *vec);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "AMDiS.h" #include "AMDiS.h"
#include "MatrixVector.h"
#include "parallel/PetscSolverFeti.h" #include "parallel/PetscSolverFeti.h"
#include "parallel/PetscSolverFetiStructs.h" #include "parallel/PetscSolverFetiStructs.h"
#include "parallel/StdMpi.h" #include "parallel/StdMpi.h"
...@@ -1351,7 +1352,7 @@ namespace AMDiS { ...@@ -1351,7 +1352,7 @@ namespace AMDiS {
// === Create all sets and indices. === // === Create all sets and indices. ===
vector<const FiniteElemSpace*> feSpaces = getFeSpaces(mat); vector<const FiniteElemSpace*> feSpaces = AMDiS::getFeSpaces(*mat);
initialize(feSpaces); initialize(feSpaces);
......
...@@ -24,7 +24,7 @@ namespace AMDiS { ...@@ -24,7 +24,7 @@ namespace AMDiS {
petscData.init(interiorMap, coarseSpaceMap, petscData.init(interiorMap, coarseSpaceMap,
subdomainLevel, mpiCommLocal, mpiCommGlobal, subdomainLevel, mpiCommLocal, mpiCommGlobal,
meshDistributor); meshDistributor);
petscData.create(); petscData.create(*seqMat);
if (coarseSpaceMap.size()) { if (coarseSpaceMap.size()) {
updateSubdomainData(); updateSubdomainData();
...@@ -130,7 +130,7 @@ namespace AMDiS { ...@@ -130,7 +130,7 @@ namespace AMDiS {
TEST_EXIT_DBG(coarseSpaceMap.size() == seqMat->getSize()) TEST_EXIT_DBG(coarseSpaceMap.size() == seqMat->getSize())
("Wrong sizes %d %d\n", 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 nRowsRankInterior = interiorMap->getRankDofs();
int nRowsOverallInterior = interiorMap->getOverallDofs(); 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