]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove deprecated functions in ConstraintMatrix. 525/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 12 Feb 2015 03:55:51 +0000 (21:55 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 12 Feb 2015 03:55:51 +0000 (21:55 -0600)
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).

doc/news/changes.h
include/deal.II/lac/constraint_matrix.h
include/deal.II/lac/constraint_matrix.templates.h
source/lac/constraint_matrix.cc
source/lac/constraint_matrix.inst.in

index c0b4a4cb060591ff57830d0e734ad9a03772ba27..ecd21c123fa93141e5ae347b94fb8a77c0749473 100644 (file)
@@ -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.
 
   <br>
   <em>With headers in <code>deal.II/deal.II/</code>:</em>
index 9348b0ddc44b5d1dacf46013fa7a05ab24d1c325..1f66ae32a8d3a22c82e335c384075dc188f50fce 100644 (file)
@@ -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 <tt>condensed</tt>. Therefore, the dimension of
-   * <tt>condensed</tt> is the dimension of <tt>uncondensed</tt> 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<typename number>
-  void condense (const SparseMatrix<number> &uncondensed,
-                 SparseMatrix<number>       &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<typename number, class VectorType>
-  void condense (const SparseMatrix<number> &uncondensed_matrix,
-                 const VectorType           &uncondensed_vector,
-                 SparseMatrix<number>       &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
index 3e37eb9e384fe9910268d5f192ac1093e9c2087b..81866d21952c1e07501b2756c6d877b9a521a318 100644 (file)
 DEAL_II_NAMESPACE_OPEN
 
 
-template<typename number>
-void
-ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed,
-                            SparseMatrix<number>       &condensed) const
-{
-  // create two dummy vectors and enter the
-  // other function
-  Vector<number> dummy (0);
-  condense (uncondensed, dummy, condensed, dummy);
-}
-
-
-
 template<typename number>
 void
 ConstraintMatrix::condense (SparseMatrix<number> &uncondensed) const
@@ -128,178 +115,6 @@ ConstraintMatrix::condense (VectorType &vec) const
 
 
 
-template<typename number, class VectorType>
-void
-ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed,
-                            const VectorType           &uncondensed_vector,
-                            SparseMatrix<number>       &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<int> new_line;
-
-  new_line.reserve (uncondensed_struct.n_rows());
-
-  std::vector<ConstraintLine>::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<n_rows; ++i)
-                new_line.push_back (i-shift);
-              break;
-            };
-        }
-      else
-        new_line.push_back (row-shift);
-
-
-  next_constraint = lines.begin();
-
-  // note: in this loop we need not check
-  // whether @p next_constraint is a valid
-  // iterator, since @p next_constraint is
-  // only evaluated so often as there are
-  // entries in new_line[*] which tells us
-  // which constraints exist
-  for (size_type row=0; row<uncondensed_struct.n_rows(); ++row)
-    if (new_line[row] != -1)
-      {
-        // line not constrained
-        // copy entries if column will not
-        // be condensed away, distribute
-        // otherwise
-        for (typename SparseMatrix<number>::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<ConstraintLine>::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<number>::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<ConstraintLine>::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<typename number, class VectorType>
 void
 ConstraintMatrix::condense (SparseMatrix<number> &uncondensed,
index edeec4dd0fdf50b7ae194b6a49ed76c88814f087..43a4a812eceb49a6dab2b784a61ee426ff65f33a 100644 (file)
@@ -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<int> new_line;
-#else
-  std::vector<long long int> new_line;
-#endif
-
-  new_line.reserve (uncondensed.n_rows());
-
-  std::vector<ConstraintLine>::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; i<n_rows; ++i)
-                new_line.push_back (i-shift);
-              break;
-            };
-        }
-      else
-        new_line.push_back (row-shift);
-
-
-  next_constraint = lines.begin();
-  // note: in this loop we need not check whether @p{next_constraint} is a
-  // valid iterator, since @p{next_constraint} is only evaluated so often as
-  // there are entries in new_line[*] which tells us which constraints exist
-  for (size_type row=0; row<uncondensed.n_rows(); ++row)
-    if (new_line[row] != -1)
-      // line not constrained copy entries if column will not be condensed
-      // away, distribute otherwise
-      for (SparsityPattern::iterator j=uncondensed.begin(row);
-           j<uncondensed.end(row); ++j)
-        if (new_line[j->column()])
-          condensed.add (new_line[row], new_line[j->column()]);
-        else
-          {
-            // let c point to the constraint of this column
-            std::vector<ConstraintLine>::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);
-             j<uncondensed.end(row); ++j)
-          // for each entry: distribute
-          if (new_line[j->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[j->column()]);
-
-          else
-            // not only this line but
-            // also this col is constrained
-            {
-              // let c point to the constraint
-              // of this column
-              std::vector<ConstraintLine>::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<types::global_dof_index> &indices
   template void ConstraintMatrix::condense<VectorType >(const VectorType &uncondensed,\
                                                         VectorType       &condensed) const;\
   template void ConstraintMatrix::condense<VectorType >(VectorType &vec) const;\
-  template void ConstraintMatrix::condense<float,VectorType >(const SparseMatrix<float> &uncondensed, \
-                                                              const VectorType &uncondensed_vector, \
-                                                              SparseMatrix<float> &condensed, \
-                                                              VectorType       &condensed_vector) const; \
-  template void ConstraintMatrix::condense<double,VectorType >(const SparseMatrix<double> &uncondensed, \
-      const VectorType &uncondensed_vector, \
-      SparseMatrix<double> &condensed, \
-      VectorType       &condensed_vector) const; \
   template void ConstraintMatrix:: \
   distribute_local_to_global<VectorType > (const Vector<double>            &, \
                                            const std::vector<ConstraintMatrix::size_type>  &, \
index 36ceda4af6d71dab54376e872a8dad678d395868..6e912d6bde8f9d262255eb21ab695584607afbb3 100644 (file)
@@ -54,7 +54,6 @@ for (V: EXTERNAL_PARALLEL_VECTORS)
 
 for (S : REAL_SCALARS)
   {
-    template void ConstraintMatrix::condense<S>(const SparseMatrix<S>&, SparseMatrix<S> &) const;
     template void ConstraintMatrix::condense<S>(SparseMatrix<S>&) const;
     template void ConstraintMatrix::condense<S>(BlockSparseMatrix<S>&) const;
   }
@@ -64,10 +63,6 @@ for (S1 : REAL_SCALARS; S2 : REAL_SCALARS)
   {
     template void ConstraintMatrix::condense<S1,Vector<S2> >(SparseMatrix<S1>&, Vector<S2>&) const;
     template void ConstraintMatrix::condense<S1,BlockVector<S2> >(BlockSparseMatrix<S1>&, BlockVector<S2>&) const;
-    template void ConstraintMatrix::condense<S1,Vector<S2> >(
-        const SparseMatrix<S1>&, const Vector<S2>&, SparseMatrix<S1> &, Vector<S2>&) const;
-    template void ConstraintMatrix::condense<S1,BlockVector<S2> >(
-        const SparseMatrix<S1>&, const BlockVector<S2>&, SparseMatrix<S1> &, BlockVector<S2>&) const;
   }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.