From ad968966a8af18193088e12724091e8a2e5e5a56 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 20 Jun 2007 13:22:43 +0000 Subject: [PATCH] Add apparently forgotten function for block compressed set sparsity patterns. git-svn-id: https://svn.dealii.org/trunk@14786 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/source/dofs/dof_constraints.cc | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/deal.II/deal.II/source/dofs/dof_constraints.cc b/deal.II/deal.II/source/dofs/dof_constraints.cc index 77aa393b69..f89b02c54b 100644 --- a/deal.II/deal.II/source/dofs/dof_constraints.cc +++ b/deal.II/deal.II/source/dofs/dof_constraints.cc @@ -1395,6 +1395,142 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const +void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) const +{ + Assert (sorted == true, ExcMatrixNotClosed()); + Assert (sparsity.n_rows() == sparsity.n_cols(), + ExcNotQuadratic()); + Assert (sparsity.n_block_rows() == sparsity.n_block_cols(), + ExcNotQuadratic()); + Assert (sparsity.get_column_indices() == sparsity.get_row_indices(), + ExcNotQuadratic()); + + const BlockIndices & + index_mapping = sparsity.get_column_indices(); + + const unsigned int n_blocks = sparsity.n_block_rows(); + + // store for each index whether it must be + // distributed or not. If entry is + // deal_II_numbers::invalid_unsigned_int, + // no distribution is necessary. + // otherwise, the number states which line + // in the constraint matrix handles this + // index + std::vector distribute (sparsity.n_rows(), + deal_II_numbers::invalid_unsigned_int); + + for (unsigned int c=0; c(c); + + 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; + const unsigned int local_row = block_index.second; + + if (distribute[row] == deal_II_numbers::invalid_unsigned_int) + // regular line. loop over + // all columns and see + // whether this column must + // be distributed. note that + // as we proceed to + // distribute cols, the loop + // over cols may get longer. + // + // don't try to be clever + // here as in the algorithm + // for the + // CompressedSparsityPattern, + // as that would be much more + // complicated here. after + // all, we know that + // compressed patterns are + // inefficient... + { + + // 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