Martin,

> I am writing a code for an optimal control problem based on dealii. For
> that purpose I need the mass and stiffness matrices only on the interior
> nodes, i.e.,
> after calling apply_boundary_values() I have the matrix K and I want
> \hat{K}=K(index,index) (in Matlab notation) where index indicates the
> interior nodes. I then only want to work with \hat{K}.

The matrix K after calling apply_boundary_values is essentially what you 
want: all rows and columns not in your index set of interior nodes are set 
to zero except for the diagonal element. In other words, if you imagine 
having numbered your degrees of freedom such that all interior nodes come 
first, and then the boundary nodes, then the top left part of the matrix 
is the matrix \hat K, and the bottom right one is a scaling of the 
identity matrix. You may want to try to build your algorithms around this.

Alternatively, you could create a ConstraintMatrix object that sets the 
boundary nodes to zero. The ConstraintMatrix has set of functions that 
condense a matrix not by zeroing out rows and columns but by copying 
everything into a new matrix (which would be your \hat K). These functions 
aren't usually used because it is so expensive to generate a second 
sparsity pattern and matrix that people typically are happier working with 
a matrix that has a few zero rows and columns.

Best
 W.

-------------------------------------------------------------------------
Wolfgang Bangerth                email:            [EMAIL PROTECTED]
                                 www: http://www.math.tamu.edu/~bangerth/


_______________________________________________

Reply via email to