From: wolf Date: Thu, 1 Apr 2004 15:07:50 +0000 (+0000) Subject: Convert one more algorithm. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f9bb7f37feea3a4a974d37bea789ff565e67365;p=dealii-svn.git Convert one more algorithm. git-svn-id: https://svn.dealii.org/trunk@8941 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 beebe35176..454794425c 100644 --- a/deal.II/deal.II/include/dofs/dof_constraints.templates.h +++ b/deal.II/deal.II/include/dofs/dof_constraints.templates.h @@ -349,60 +349,34 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed) const // therein for (unsigned int block_col=0; block_col::iterator + entry = uncondensed.block(block_row, block_col).begin(block_index.second); + entry != uncondensed.block(block_row, block_col).end(block_index.second); + ++entry) + { + const unsigned int global_col + = index_mapping.local_to_global(block_col,entry->column()); - if (distribute[global_col] != deal_II_numbers::invalid_unsigned_int) - // distribute - // entry at - // regular row - // @p{row} and - // irregular - // column - // global_col; - // set old - // entry to - // zero - { - const double old_value = - uncondensed.block(block_row,block_col).global_entry(j); + if (distribute[global_col] != deal_II_numbers::invalid_unsigned_int) + // distribute entry at + // regular row @p{row} + // and irregular column + // global_col; set old + // entry to zero + { + const double old_value = entry->value (); - for (unsigned int q=0; - q!=lines[distribute[global_col]] - .entries.size(); ++q) - uncondensed.add (row, - lines[distribute[global_col]].entries[q].first, - old_value * - lines[distribute[global_col]].entries[q].second); - - uncondensed.block(block_row,block_col).global_entry(j) - = 0.; - }; - }; - }; + for (unsigned int q=0; + q!=lines[distribute[global_col]].entries.size(); ++q) + uncondensed.add (row, + lines[distribute[global_col]].entries[q].first, + old_value * + lines[distribute[global_col]].entries[q].second); + + entry->value() = 0.; + } + } + } } else { @@ -413,91 +387,62 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed) const // blocks for (unsigned int block_col=0; block_col::iterator + entry = uncondensed.block(block_row, block_col).begin(block_index.second); + entry != uncondensed.block(block_row, block_col).end(block_index.second); + ++entry) + { + const unsigned int global_col + = index_mapping.local_to_global (block_col, entry->column()); - if (distribute[global_col] == - deal_II_numbers::invalid_unsigned_int) - // distribute - // entry at - // irregular - // row @p{row} - // and regular - // column - // global_col. set - // old entry to - // zero - { - const double old_value - = uncondensed.block(block_row,block_col).global_entry(j); + if (distribute[global_col] == + deal_II_numbers::invalid_unsigned_int) + // distribute + // entry at + // irregular + // row @p{row} + // and regular + // column + // global_col. set + // old entry to + // zero + { + const double old_value = entry->value(); - for (unsigned int q=0; - q!=lines[distribute[row]].entries.size(); ++q) - uncondensed.add (lines[distribute[row]].entries[q].first, - global_col, - old_value * - lines[distribute[row]].entries[q].second); - - uncondensed.block(block_row,block_col).global_entry(j) = 0.; - } - else - // distribute - // entry at - // irregular - // row @p{row} - // and - // irregular - // column - // @p{global_col} - // set old - // entry to one - // if on main - // diagonal, - // zero - // otherwise - { - const double old_value - = uncondensed.block(block_row,block_col).global_entry(j); + for (unsigned int q=0; + q!=lines[distribute[row]].entries.size(); ++q) + uncondensed.add (lines[distribute[row]].entries[q].first, + global_col, + old_value * + lines[distribute[row]].entries[q].second); + + entry->value() = 0.; + } + else + // distribute entry at + // irregular row @p{row} + // and irregular column + // @p{global_col} set old + // entry to one if on + // main diagonal, zero + // otherwise + { + const double old_value = entry->value (); - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) - uncondensed.add (lines[distribute[row]].entries[p].first, - lines[distribute[global_col]].entries[q].first, - old_value * - lines[distribute[row]].entries[p].second * - lines[distribute[global_col]].entries[q].second); - - uncondensed.block(block_row,block_col).global_entry(j) - = (row == global_col ? average_diagonal : 0. ); - }; - }; - }; - }; - }; + for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + uncondensed.add (lines[distribute[row]].entries[p].first, + lines[distribute[global_col]].entries[q].first, + old_value * + lines[distribute[row]].entries[p].second * + lines[distribute[global_col]].entries[q].second); + + entry->value() = (row == global_col ? average_diagonal : 0. ); + } + } + } + } + } }