From: wolf Date: Fri, 19 May 2000 15:33:30 +0000 (+0000) Subject: Implement more functions for block matrices as well. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16ca83c2847922f22cdd91a196c89f4667f86a00;p=dealii-svn.git Implement more functions for block matrices as well. git-svn-id: https://svn.dealii.org/trunk@2902 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_constraints.templates.h b/deal.II/deal.II/include/dofs/dof_constraints.templates.h index 0bc781c646..f39cb8877e 100644 --- a/deal.II/deal.II/include/dofs/dof_constraints.templates.h +++ b/deal.II/deal.II/include/dofs/dof_constraints.templates.h @@ -21,8 +21,6 @@ template void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const { - Assert (false, ExcInternalError()); -/* Assert (sorted == true, ExcMatrixNotClosed()); Assert (sparsity.is_compressed() == false, ExcMatrixIsClosed()); Assert (sparsity.n_rows() == sparsity.n_cols(), @@ -30,76 +28,132 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) Assert (sparsity.get_column_indices() == sparsity.get_row_indices(), ExcMatrixNotSquare()); + const BlockIndices & + index_mapping = sparsity.get_column_indices(); + // store for each index whether it // must be distributed or not. If entry // is -1, no distribution is necessary. // otherwise, the number states which // line in the constraint matrix handles // this index - vector distribute(sparsity.n_rows(), -1); + vector distribute (sparsity.n_rows(), -1); for (unsigned int c=0; c(c); - int n_rows = sparsity.n_rows(); - for (int row=0; row + block_index = index_mapping.global_to_local(row); + const unsigned int block_row = block_index.first; + if (distribute[row] == -1) - // regular line. loop over cols - for (unsigned int j=sparsity.get_rowstart_indices()[row]; - j &uncondensed, vector::const_iterator next_constraint = lines.begin(); unsigned int shift = 0; - unsigned int n_rows = uncondensed_struct.n_rows(); + const unsigned int n_rows = uncondensed_struct.n_rows(); if (next_constraint == lines.end()) // if no constraint is to be handled @@ -378,21 +432,29 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed const unsigned int n_rows = sparsity.n_rows(); for (unsigned int row=0; row + block_index = index_mapping.global_to_local(row); + const unsigned int block_row = block_index.first; + if (distribute[row] == -1) + // regular line. loop over + // all columns and see + // whether this column must + // be distributed { - // get index of this row - // within the blocks - const pair - block_index = index_mapping.global_to_local(row); - - // regular line. loop over - // all columns and see - // whether this column must - // be distributed + + // to loop over all entries + // in this row, we have to + // loop over all blocks in + // this blockrow and the + // corresponding row + // therein for (unsigned int block_col=0; block_col &uncondensed else { const unsigned int global_col - =index_mapping.local_to_global(block_col, - block_sparsity.get_column_numbers()[j]); + = index_mapping.local_to_global(block_col, + block_sparsity.get_column_numbers()[j]); if (distribute[global_col] != -1) // distribute entry at regular @@ -420,7 +482,7 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed // set old entry to zero { const double old_value = - uncondensed.block(block_index.first,block_col).global_entry(j); + uncondensed.block(block_row,block_col).global_entry(j); for (unsigned int q=0; q!=lines[distribute[global_col]] @@ -430,7 +492,7 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed old_value * lines[distribute[global_col]].entries[q].second); - uncondensed.block(block_index.first,block_col).global_entry(j) + uncondensed.block(block_row,block_col).global_entry(j) = 0.; }; }; @@ -438,61 +500,77 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed } else { - Assert (false, ExcInternalError()); -/* - // row must be distributed - for (unsigned int j=sparsity.get_rowstart_indices()[row]; - j(c); - unsigned int n_rows = sparsity.n_rows(); + const unsigned int n_rows = sparsity.n_rows(); for (unsigned int row=0; row