Fixes the laplacian.

As we do not represent dofs on the boundary, we need to make sure that all diagonal
values are 4.
This commit is contained in:
Markus Blatt 2014-03-20 22:21:03 +01:00
parent 8d9cd23722
commit eda0be1b8c

View File

@ -60,21 +60,18 @@ std::shared_ptr<MyMatrix> createLaplacian(int N)
int x=row%N;
int y=row/N;
double dval=0;
if(y>0)
{
mm->colIndex[nnz]=row-N;
mm->data[nnz++]=-1;
dval+=1;
}
if(x>0)
{
mm->colIndex[nnz]=row-1;
mm->data[nnz++]=-1;
dval+=1;
}
mm->colIndex[nnz]=row;
mm->data[nnz++]=dval+(x<N-1)+(y<N-1);
mm->data[nnz++]=4;
if(x<N-1)
{
mm->colIndex[nnz]=row+1;