From: Wolfgang Bangerth Date: Thu, 12 Feb 2015 03:55:51 +0000 (-0600) Subject: Remove deprecated functions in ConstraintMatrix. X-Git-Tag: v8.3.0-rc1~479^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=863ac33cd963b323c0acd53d83ab6f348982e3cd;p=dealii.git Remove deprecated functions in ConstraintMatrix. Specifically, remove the functions that actually create a shrunk linear system, rather than zeroing out rows and columns in an existing linear system. These functions were a bad idea when they were introduced in 1998, and they still are today. We've never used them in anything and they are not used in any of the tutorials or tests. It is true that I've only deprecated one of the functions yesterday or the day before and remove it today. On the other hand, anyone who would have used that function to shrink a sparsity pattern (which was not previously deprecated) would also have had to use the corresponding function on their matrix (which was already deprecated). --- diff --git a/doc/news/changes.h b/doc/news/changes.h index c0b4a4cb06..ecd21c123f 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -177,6 +177,10 @@ inconvenience this causes. - SparseMatrixIterators::Accessor and SparseMatrixIterators::Iterator constructors. - SparseMatrix::raw_entry and SparseMatrix::global_entry. + - The ConstraintMatrix functions that transform a matrix, vector, or + linear system into a smaller by not just setting the corresponding + rows and columns to zero, but actually shrinking the size of the + linear system.
With headers in deal.II/deal.II/: diff --git a/include/deal.II/lac/constraint_matrix.h b/include/deal.II/lac/constraint_matrix.h index 9348b0ddc4..1f66ae32a8 100644 --- a/include/deal.II/lac/constraint_matrix.h +++ b/include/deal.II/lac/constraint_matrix.h @@ -519,25 +519,6 @@ public: * @{ */ - /** - * Condense a given sparsity pattern. This function assumes the uncondensed - * matrix struct to be compressed and the one to be filled to be empty. The - * condensed structure is compressed afterwards. - * - * The constraint matrix object must be closed to call this function. - * - * @note The hanging nodes are completely eliminated from the linear system - * referring to condensed. Therefore, the dimension of - * condensed is the dimension of uncondensed minus the - * number of constrained degrees of freedom. - * - * @deprecated The functions converting an uncondensed matrix into its - * condensed form are deprecated. Use the functions doing the in-place - * condensation leaving the size of the linear system unchanged. - */ - void condense (const SparsityPattern &uncondensed, - SparsityPattern &condensed) const DEAL_II_DEPRECATED; - /** * Condense a sparsity pattern. The name of the function mimics the @@ -622,22 +603,6 @@ public: */ void condense (BlockCompressedSimpleSparsityPattern &sparsity) const; - - /** - * Condense a given matrix. The associated matrix struct should be condensed - * and compressed. It is the user's responsibility to guarantee that all - * entries in the @p condensed matrix be zero! - * - * The constraint matrix object must be closed to call this function. - * - * @deprecated The functions converting an uncondensed matrix into its - * condensed form are deprecated. Use the functions doing the in-place - * condensation leaving the size of the linear system unchanged. - */ - template - void condense (const SparseMatrix &uncondensed, - SparseMatrix &condensed) const DEAL_II_DEPRECATED; - /** * Condense a given matrix, i.e., eliminate the rows and columns of * the matrix that correspond to constrained degrees of freedom. @@ -678,28 +643,6 @@ public: void condense (const VectorType &vec_ghosted, VectorType &output) const; - /** - * Condense a given matrix and a given vector by eliminating rows - * and columns of the linear system that correspond to constrained - * degrees of freedom. The sparsity pattern associated with the - * matrix needs to be condensed and compressed. This function is - * the appropriate choice for applying inhomogeneous constraints. - * - * The constraint matrix object must be closed to call this function. - * - * See the general documentation of this - * class for more detailed information. - * - * @deprecated The functions converting an uncondensed matrix into its - * condensed form are deprecated. Use the functions doing the in-place - * condensation leaving the size of the linear system unchanged. - */ - template - void condense (const SparseMatrix &uncondensed_matrix, - const VectorType &uncondensed_vector, - SparseMatrix &condensed_matrix, - VectorType &condensed_vector) const DEAL_II_DEPRECATED; - /** * Condense a given matrix and a given vector by eliminating rows * and columns of the linear system that correspond to constrained diff --git a/include/deal.II/lac/constraint_matrix.templates.h b/include/deal.II/lac/constraint_matrix.templates.h index 3e37eb9e38..81866d2195 100644 --- a/include/deal.II/lac/constraint_matrix.templates.h +++ b/include/deal.II/lac/constraint_matrix.templates.h @@ -37,19 +37,6 @@ DEAL_II_NAMESPACE_OPEN -template -void -ConstraintMatrix::condense (const SparseMatrix &uncondensed, - SparseMatrix &condensed) const -{ - // create two dummy vectors and enter the - // other function - Vector dummy (0); - condense (uncondensed, dummy, condensed, dummy); -} - - - template void ConstraintMatrix::condense (SparseMatrix &uncondensed) const @@ -128,178 +115,6 @@ ConstraintMatrix::condense (VectorType &vec) const -template -void -ConstraintMatrix::condense (const SparseMatrix &uncondensed, - const VectorType &uncondensed_vector, - SparseMatrix &condensed, - VectorType &condensed_vector) const -{ - // check whether we work on real vectors - // or we just used a dummy when calling - // the other function above. - const bool use_vectors = (uncondensed_vector.size() == 0 && - condensed_vector.size() == 0) ? false : true; - - const SparsityPattern &uncondensed_struct = uncondensed.get_sparsity_pattern (); - - Assert (sorted == true, ExcMatrixNotClosed()); - Assert (uncondensed_struct.is_compressed() == true, ExcMatrixNotClosed()); - Assert (condensed.get_sparsity_pattern().is_compressed() == true, ExcMatrixNotClosed()); - Assert (uncondensed_struct.n_rows() == uncondensed_struct.n_cols(), - ExcNotQuadratic()); - Assert (condensed.n() == condensed.m(), - ExcNotQuadratic()); - AssertDimension (condensed.n()+n_constraints(), uncondensed.n()); - if (use_vectors == true) - { - AssertDimension (condensed_vector.size()+n_constraints(), - uncondensed_vector.size()); - AssertDimension (condensed_vector.size(), condensed.m()); - } - - // store for each line of the matrix - // its new line number - // after compression. If the shift is - // -1, this line will be condensed away - std::vector new_line; - - new_line.reserve (uncondensed_struct.n_rows()); - - std::vector::const_iterator next_constraint = lines.begin(); - size_type shift = 0; - const size_type n_rows = uncondensed_struct.n_rows(); - - if (next_constraint == lines.end()) - // if no constraint is to be handled - for (size_type row=0; row!=n_rows; ++row) - new_line.push_back (row); - else - for (size_type row=0; row!=n_rows; ++row) - if (row == next_constraint->line) - { - // this line is constrained - new_line.push_back (-1); - // note that @p lines is ordered - ++shift; - ++next_constraint; - if (next_constraint == lines.end()) - // nothing more to do; finish rest - // of loop - { - for (size_type i=row+1; i::const_iterator - p = uncondensed.begin(row); - p != uncondensed.end(row); ++p) - if (new_line[p->column()] != -1) - condensed.add (new_line[row], - new_line[p->column()], - p->value()); - else - { - // let c point to the - // constraint of this column - std::vector::const_iterator c = lines.begin(); - while (c->line != p->column()) - ++c; - - for (size_type q=0; q!=c->entries.size(); ++q) - // distribute to rows with - // appropriate weight - condensed.add (new_line[row], new_line[c->entries[q].first], - p->value() * c->entries[q].second); - - // take care of inhomogeneity: - // need to subtract this element from the - // vector. this corresponds to an - // explicit elimination in the respective - // row of the inhomogeneous constraint in - // the matrix with Gauss elimination - if (use_vectors == true) - condensed_vector(new_line[row]) -= p->value() * - c->inhomogeneity; - } - - if (use_vectors == true) - condensed_vector(new_line[row]) += uncondensed_vector(row); - } - else - // line must be distributed - { - for (typename SparseMatrix::const_iterator - p = uncondensed.begin(row); - p != uncondensed.end(row); ++p) - // for each column: distribute - if (new_line[p->column()] != -1) - // column is not constrained - for (size_type q=0; q!=next_constraint->entries.size(); ++q) - condensed.add (new_line[next_constraint->entries[q].first], - new_line[p->column()], - p->value() * - next_constraint->entries[q].second); - - else - // not only this line but - // also this col is constrained - { - // let c point to the constraint - // of this column - std::vector::const_iterator c = lines.begin(); - while (c->line != p->column()) - ++c; - - for (size_type r=0; r!=c->entries.size(); ++r) - for (size_type q=0; q!=next_constraint->entries.size(); ++q) - condensed.add (new_line[next_constraint->entries[q].first], - new_line[c->entries[r].first], - p->value() * - next_constraint->entries[r].second * - c->entries[r].second); - - if (use_vectors == true) - for (size_type q=0; q!=next_constraint->entries.size(); ++q) - condensed_vector (new_line[next_constraint->entries[q].first]) - -= p->value() * - next_constraint->entries[q].second * - c->inhomogeneity; - } - - // condense the vector - if (use_vectors == true) - for (size_type q=0; q!=next_constraint->entries.size(); ++q) - condensed_vector(new_line[next_constraint->entries[q].first]) - += - uncondensed_vector(row) * next_constraint->entries[q].second; - - ++next_constraint; - }; -} - - - template void ConstraintMatrix::condense (SparseMatrix &uncondensed, diff --git a/source/lac/constraint_matrix.cc b/source/lac/constraint_matrix.cc index edeec4dd0f..43a4a812ec 100644 --- a/source/lac/constraint_matrix.cc +++ b/source/lac/constraint_matrix.cc @@ -641,109 +641,6 @@ void ConstraintMatrix::reinit (const IndexSet &local_constraints) -void ConstraintMatrix::condense (const SparsityPattern &uncondensed, - SparsityPattern &condensed) const -{ - Assert (sorted == true, ExcMatrixNotClosed()); - Assert (uncondensed.is_compressed() == true, ExcMatrixNotClosed()); - Assert (uncondensed.n_rows() == uncondensed.n_cols(), ExcNotQuadratic()); - - // store for each line of the matrix its new line number after - // compression. If the shift is -1, this line will be condensed away -#ifndef DEAL_II_WITH_64BIT_INDICES - std::vector new_line; -#else - std::vector new_line; -#endif - - new_line.reserve (uncondensed.n_rows()); - - std::vector::const_iterator next_constraint = lines.begin(); - size_type shift = 0; - size_type n_rows = uncondensed.n_rows(); - - if (next_constraint == lines.end()) - // if no constraint is to be handled - for (size_type row=0; row!=n_rows; ++row) - new_line.push_back (row); - else - for (size_type row=0; row!=n_rows; ++row) - if (row == next_constraint->line) - { - // this line is constrained - new_line.push_back (-1); - // note that @p{lines} is ordered - ++shift; - ++next_constraint; - if (next_constraint == lines.end()) - // nothing more to do; finish rest of loop - { - for (size_type i=row+1; icolumn()]) - condensed.add (new_line[row], new_line[j->column()]); - else - { - // let c point to the constraint of this column - std::vector::const_iterator c = lines.begin(); - while (c->line != j->column()) - ++c; - - for (size_type q=0; q!=c->entries.size(); ++q) - condensed.add (new_line[row], new_line[c->entries[q].first]); - } - else - // line must be distributed - { - for (SparsityPattern::iterator j=uncondensed.begin(row); - jcolumn()] != -1) - // column is not constrained - for (size_type q=0; q!=next_constraint->entries.size(); ++q) - condensed.add (new_line[next_constraint->entries[q].first], - new_line[j->column()]); - - else - // not only this line but - // also this col is constrained - { - // let c point to the constraint - // of this column - std::vector::const_iterator c = lines.begin(); - while (c->line != j->column()) ++c; - - for (size_type p=0; p!=c->entries.size(); ++p) - for (size_type q=0; q!=next_constraint->entries.size(); ++q) - condensed.add (new_line[next_constraint->entries[q].first], - new_line[c->entries[p].first]); - }; - - ++next_constraint; - }; - - condensed.compress(); -} - - - void ConstraintMatrix::condense (SparsityPattern &sparsity) const { Assert (sorted == true, ExcMatrixNotClosed()); @@ -1715,14 +1612,6 @@ ConstraintMatrix::resolve_indices (std::vector &indices template void ConstraintMatrix::condense(const VectorType &uncondensed,\ VectorType &condensed) const;\ template void ConstraintMatrix::condense(VectorType &vec) const;\ - template void ConstraintMatrix::condense(const SparseMatrix &uncondensed, \ - const VectorType &uncondensed_vector, \ - SparseMatrix &condensed, \ - VectorType &condensed_vector) const; \ - template void ConstraintMatrix::condense(const SparseMatrix &uncondensed, \ - const VectorType &uncondensed_vector, \ - SparseMatrix &condensed, \ - VectorType &condensed_vector) const; \ template void ConstraintMatrix:: \ distribute_local_to_global (const Vector &, \ const std::vector &, \ diff --git a/source/lac/constraint_matrix.inst.in b/source/lac/constraint_matrix.inst.in index 36ceda4af6..6e912d6bde 100644 --- a/source/lac/constraint_matrix.inst.in +++ b/source/lac/constraint_matrix.inst.in @@ -54,7 +54,6 @@ for (V: EXTERNAL_PARALLEL_VECTORS) for (S : REAL_SCALARS) { - template void ConstraintMatrix::condense(const SparseMatrix&, SparseMatrix &) const; template void ConstraintMatrix::condense(SparseMatrix&) const; template void ConstraintMatrix::condense(BlockSparseMatrix&) const; } @@ -64,10 +63,6 @@ for (S1 : REAL_SCALARS; S2 : REAL_SCALARS) { template void ConstraintMatrix::condense >(SparseMatrix&, Vector&) const; template void ConstraintMatrix::condense >(BlockSparseMatrix&, BlockVector&) const; - template void ConstraintMatrix::condense >( - const SparseMatrix&, const Vector&, SparseMatrix &, Vector&) const; - template void ConstraintMatrix::condense >( - const SparseMatrix&, const BlockVector&, SparseMatrix &, BlockVector&) const; }