Commit 806b9b01 authored by Naumann, Andreas's avatar Naumann, Andreas

wrong matrix sizes and assembly

parent 7cb341b6
......@@ -159,7 +159,7 @@ namespace AMDiS {
for (size_t k = 0; k < static_cast<size_t>(rhs.getSize()); k++)
nnz[k] = rhs.getBaseMatrix().nnz_local(k);
MatCreateSeqAIJ(PETSC_COMM_SELF, rhs.getSize(), rhs.getSize(), 0, &(nnz[0]), &mat);
MatCreateSeqAIJ(PETSC_COMM_SELF, num_rows(rhs.getBaseMatrix()), num_cols(rhs.getBaseMatrix()), 0, &(nnz[0]), &mat);
initMatrix = true;
}
......@@ -168,7 +168,8 @@ namespace AMDiS {
indices.push_back(rhs.getBaseMatrix().ref_minor()[i]);
for (PetscInt i = 0; i < static_cast<PetscInt>(num_rows(rhs.getBaseMatrix())); i++) {
MatSetValues(mat, 1, &i, rhs.getBaseMatrix().nnz_local(i),
if (rhs.getBaseMatrix().nnz_local(i) > 0)
MatSetValues(mat, 1, &i, rhs.getBaseMatrix().nnz_local(i),
&(indices[rhs.getBaseMatrix().ref_major()[i]]),
&(rhs.getBaseMatrix().value_from_offset(rhs.getBaseMatrix().ref_major()[i])), ADD_VALUES);
}
......@@ -239,7 +240,7 @@ namespace AMDiS {
/// fill PETSc vector from DOFVector
inline void operator<<(Vec& petscVec, /* const */SystemVector& vec)
{
VecType vecType; // TODO: type changed from petsc 3.2 to petsc 3.3
const VecType vecType; // TODO: type changed from petsc 3.2 to petsc 3.3
VecGetType(petscVec, &vecType);
if (strcmp(vecType, VECNEST) == 0) {
......@@ -264,7 +265,7 @@ namespace AMDiS {
/// fill SystemVector from PETSc vector
inline void operator>>(const Vec& petscVec, SystemVector& vec)
{
VecType vecType;
const VecType vecType;
VecGetType(petscVec, &vecType);
if (strcmp(vecType, VECNEST) == 0) {
......
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