<h3 style="color:red">Incompatibilities</h3>
<ol>
- <li> <p> Changed: All the vector and block vector classes had a member
+ <li> <p> Removed: All the matrix classes have functions <code
+ class="member">reinit</code> that are used to resize the
+ matrix. However, the sparse matrix classes had an equally named
+ function without arguments that basically left the size of the matrix
+ unchanged but set all elements of the matrix to zero. It could also be
+ abused to notify the matrix that the sparsity pattern on which it is
+ built has changed, an inherently risky procedure. The no-argument code
+ <class="member">reinit</code> function has therefore been removed to
+ avoid confusion with the <code class="member">reinit</code> functions
+ that take arguments. Instead, a <code class="member">set_zero</code>
+ function has been introduced that simply sets all elements of the
+ matrix to zero. If you want to notify a sparse matrix that its sparsity
+ pattern has changed, use the <code
+ class="member">reinit(SparsityPattern)</code> function.
+ <br>
+ (WB 2004/05/10)
+ </p>
+
+ <li> <p> Removed: All the vector and block vector classes had a member
function <code class="member">clear</code> which simply resets all
values of the vector to zero. It did not change the size of the vector,
though. This was confusing, since the standard C++ container classes
(WB 2004/05/10)
</p>
+ <li> <p> Removed: The <code
+ class="member">SparseLUDecomposition::reinit</code> and <code
+ class="member">SparseMIC::reinit</code> functions without
+ argument had been deprecated before, and have now been removed.
+ <br>
+ (WB 2004/05/10)
+ </p>
+
<li> <p> Changed: the template parameter of <code
class="class">MGTransferPrebuilt</code> is now the complete vector
type, not just the value type of the vector. This allows to operate
// reinit the system matrix, the
// right hand side vector and
// the Timer object.
- system_matrix.reinit();
+ system_matrix.set_zero();
right_hand_side = 0;
assemble_timer.reset();
operator = (const BlockSparseMatrix<number> &);
/**
- * Reinitialize the object but
- * keep to the sparsity pattern
- * previously used. This may be
- * necessary if you reinitialized
- * the sparsity structure and
- * want to update the size of the
- * matrix. It only calls
- * SparseMatrix::reinit() on the
- * sub-matrices. The size of this
- * matrix is unchanged.
- *
- * If the sparsity pattern has
- * not changed, then the effect
- * of this function is simply to
- * reset all matrix entries to
- * zero.
+ * Set all elements of the matrix to
+ * zero, but keep the sparsity pattern
+ * previously used.
*/
- virtual void reinit ();
+ void set_zero ();
/**
* Reinitialize the sparse matrix
template <typename number>
void
-BlockSparseMatrix<number>::reinit ()
+BlockSparseMatrix<number>::set_zero ()
{
for (unsigned int r=0; r<rows; ++r)
for (unsigned int c=0; c<columns; ++c)
- block(r,c).reinit ();
+ block(r,c).set_zero ();
}
* retain the sparsity pattern and all
* the other properties of the matrix.
*/
- void reinit ();
+ void set_zero ();
/**
* Set the element (<i>i,j</i>)
* function simply calls the respective
* function of the base class.
*/
- void reinit ();
+ void set_zero ();
/**
* Throw away the present matrix and
const std::vector<unsigned int> &row_lengths,
const bool is_symmetric = false);
- /**
- * Set all matrix entries to zero, but
- * retain the sparsity pattern. This
- * function simply calls the respective
- * function of the base class.
- */
- void reinit ();
-
/**
* Throw away the present matrix and
* generate one that has the same
const std::vector<unsigned int> &row_lengths,
const bool is_symmetric = false);
};
-
-
-/// @if NoDoc
-// -------- template and inline functions ----------
-
- inline
- void
- SparseMatrix::reinit ()
- {
- MatrixBase::reinit ();
- }
-///@endif
}
#endif // DEAL_II_USE_PETSC
void initialize (const SparseMatrix<somenumber> &matrix,
const AdditionalData parameters);
- /**
- * This method is deprecated,
- * and left for backward
- * compability. It will be removed
- * in later versions.
- */
- void reinit ();
-
/**
* This method is deprecated,
* and left for backward
//--------------------- sparse_decomposition.templates.h ----------------
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
// by the deal.II authors and Stephen "Cheffo" Kolaroff
//
// This file is subject to QPL and may not be distributed
-template <typename number>
-void
-SparseLUDecomposition<number>::reinit ()
-{
- decomposed = false;
- if (true)
- {
- std::vector<const unsigned int*> tmp;
- tmp.swap (prebuilt_lower_bound);
- };
- SparseMatrix<number>::reinit ();
-}
-
-
-
template <typename number>
void SparseLUDecomposition<number>::reinit (const SparsityPattern& sparsity)
{
SparseMatrix<number>& operator = (const SparseMatrix<number> &);
/**
- * Reinitialize the object but
- * keep to the sparsity pattern
- * previously used. This may be
- * necessary if the sparsity
- * structure has changed and you
- * want to update the size of the
- * matrix.
- *
- * Note that memory is only
- * reallocated if the new size
- * exceeds the old size. If that
- * is not the case, the allocated
- * memory is not reduced. However,
- * if the sparsity structure is
- * empty (i.e. the dimensions are
- * zero), then all memory is
- * freed.
- *
- * If the sparsity pattern has
- * not changed, then the effect
- * of this function is simply to
- * reset all matrix entries to
- * zero.
+ * Set all elements to zero, but keep to
+ * the sparsity pattern of the matrix.
*/
- virtual void reinit ();
+ virtual void set_zero ();
/**
* Reinitialize the sparse matrix
template <typename number>
SparseMatrix<number>::SparseMatrix (const SparsityPattern &c) :
- cols(&c),
+ cols(0),
val(0),
max_len(0)
{
- reinit();
+ reinit (c);
}
template <typename number>
void
-SparseMatrix<number>::reinit ()
+SparseMatrix<number>::set_zero ()
{
Assert (cols != 0, ExcMatrixNotInitialized());
Assert (cols->compressed || cols->empty(), ExcNotCompressed());
- if (cols->empty())
+ if (val)
+ std::fill_n (&val[0], cols->n_nonzero_elements(), 0);
+}
+
+
+
+template <typename number>
+void
+SparseMatrix<number>::reinit (const SparsityPattern &sparsity)
+{
+ cols = &sparsity;
+
+ if (cols->empty())
{
- if (val) delete[] val;
+ if (val != 0)
+ delete[] val;
val = 0;
max_len = 0;
return;
- };
+ }
const unsigned int N = cols->n_nonzero_elements();
if (N > max_len || max_len == 0)
{
- if (val) delete[] val;
+ if (val != 0)
+ delete[] val;
val = new number[N];
max_len = N;
- };
+ }
- if (val)
+ if (val != 0)
std::fill_n (&val[0], N, 0);
}
-template <typename number>
-void
-SparseMatrix<number>::reinit (const SparsityPattern &sparsity)
-{
- cols = &sparsity;
- reinit ();
-}
-
-
-
template <typename number>
void
SparseMatrix<number>::clear ()
SparseMatrix<number>::copy_from (const FullMatrix<somenumber> &matrix)
{
// first delete previous content
- reinit ();
+ set_zero ();
// then copy old matrix
for (unsigned int row=0; row<matrix.m(); ++row)
//---------------------------- sparse_mic.h ---------------------------
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
// by the deal.II authors and Stephen "Cheffo" Kolaroff
//
// This file is subject to QPL and may not be distributed
typename SparseLUDecomposition<number>::AdditionalData
AdditionalData;
- /**
- * This method is deprecated, and
- * left for backward
- * compability. It will be
- * removed in later versions.
- */
- void reinit ();
-
/**
* This method is deprecated, and
* left for backward
//---------------------------- sparse_mic.templates.h ---------------------------
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
// by the deal.II authors and Stephen "Cheffo" Kolaroff
//
// This file is subject to QPL and may not be distributed
-template <typename number>
-void
-SparseMIC<number>::reinit ()
-{
- if (true)
- {
- std::vector<number> tmp;
- tmp.swap (diag);
- };
- if (true)
- {
- std::vector<number> tmp;
- tmp.swap (inv_diag);
- };
- if (true)
- {
- std::vector<number> tmp;
- tmp.swap (inner_sums);
- };
-
- SparseLUDecomposition<number>::reinit ();
-}
-
-
-
template <typename number>
void SparseMIC<number>::reinit (const SparsityPattern& sparsity)
{
void
- MatrixBase::reinit ()
+ MatrixBase::set_zero ()
{
const int ierr = MatZeroEntries (matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));