MatZeroColsIS question.
Toby D. Young
tyoung at ippt.gov.pl
Tue Sep 4 07:08:45 CDT 2007
Hello,
Being relatively new to Petsc I wanted to ask other users if this is an
appropriate approach to a problem of applying boundary conditions to a
matrix.
I am trying to apply Dirichlet boundary conditions on a PetSc matrix by
zeroing out the rows and columns in the usual way. The reason to zero
out the columns is to preserve the symmetrey of the matrix.
I know the row numbers I need to zero out. While zeroing out rows is
simple using MatZeroRowsIS() there does not seem to be a synomonous
MatZeroColsIS(). The problem I have here is to construct one from
the other routines available in Petsc.
In that case I hope to get the nonzero column indices of a specific row
and then to forcively set these nonzero column entries to zero. I am
assuming this is possible using
MatGetRow(matrix, row, ncols, colnums, values);
where "colnums" will give me the column numbers of nonzero matrix
elements for that row, if I understand this routine correctly?? :-)
followed by
MatSetValues (matrix, 1, row, 1, colnums[j], 0, INSERT_VALUES);
and loop for all rows that were zeroed out in the previous step.
Although this is a rather inefficient I hope it should work. Has anyone
concieved of or could suggest a more effective approach for
constructing a MatZeroColsIS?
I welcome any response / advice and thank you in advance.
Best,
Toby
I am using c++ (gcc 4.1.0) and petsc 2.3.0.
--
Toby D. Young ( Adiunkt )
Department of Computational Science
Institute of Fundamental Technological Research, Polish Academy of
Sciences, Room 206, Swietokrzyska 21, 00-049 Warsaw, POLAND
More information about the petsc-users
mailing list