* Exception
*/
DeclException0 (ExcMatrixNotInitialized);
- /**
- * Exception
- */
- DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
private:
/**
// $Id$
// Version: $Name$
//
-// Copyright (C) 2002, 2003 by the deal.II authors
+// Copyright (C) 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
BlockSparseMatrixEZ & operator = (const BlockSparseMatrixEZ<Number>&);
+ /**
+ * This operator assigns a scalar to
+ * a matrix. Since this does usually
+ * not make much sense (should we set
+ * all matrix entries to this value?
+ * Only the nonzero entries of the
+ * sparsity pattern?), this operation
+ * is only allowed if the actual
+ * value to be assigned is zero. This
+ * operator only exists to allow for
+ * the obvious notation
+ * <tt>matrix=0</tt>, which sets all
+ * elements of the matrix to zero,
+ * but keep the sparsity pattern
+ * previously used.
+ */
+ BlockSparseMatrixEZ & operator = (const double d);
+
+
/**
* Set matrix to zero dimensions
* and release memory.
// $Id$
// Version: $Name$
//
-// Copyright (C) 2002, 2003 by the deal.II authors
+// Copyright (C) 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
+template <typename number>
+BlockSparseMatrixEZ<number> &
+BlockSparseMatrixEZ<number>::operator = (const double d)
+{
+ Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
+
+ for (unsigned int r=0; r<n_block_rows(); ++r)
+ for (unsigned int c=0; c<n_block_cols(); ++c)
+ block(r,c) = 0;
+
+ return *this;
+}
+
+
+
template <typename number>
BlockSparseMatrixEZ<number>::BlockSparseMatrixEZ (
const BlockSparseMatrixEZ<number> &m)
operator = (const FullMatrix<number2>&);
/**
- * This operator assigns a scalar to a
- * matrix. Since this does usually not
- * make much sense (should we set all
- * matrix entries to this value? Only the
- * nonzero entries of the sparsity
- * pattern?), this operation is only
- * allowed if the actual value to be
- * assigned is zero. This operator only
- * exists to allow for the obvious
- * notation <tt>matrix=0</tt>, which sets
- * all elements of the matrix to zero.
+ * This operator assigns a scalar
+ * to a matrix. To avoid
+ * confusion with constructors,
+ * zero is the only value allowed
+ * for <tt>d</tt>
*/
FullMatrix<number> &
operator = (const double d);
<< "Target region not in matrix: size in this direction="
<< arg1 << ", size of new matrix=" << arg2
<< ", offset=" << arg3);
- /**
- * Exception
- */
- DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
/**
* Exception
*/
* Exception
*/
DeclException0 (ExcMatrixNotSquare);
- /**
- * Exception
- */
- DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
protected:
/**
* Exception
*/
DeclException0 (ExcSourceEqualsDestination);
- /**
- * Exception
- */
- DeclException0 (ExcScalarAssignmentOnlyForZeroValue);
private:
/**
*/
SparseMatrixEZ<number>& operator = (const SparseMatrixEZ<number> &);
+ /**
+ * This operator assigns a scalar to
+ * a matrix. Since this does usually
+ * not make much sense (should we set
+ * all matrix entries to this value?
+ * Only the nonzero entries of the
+ * sparsity pattern?), this operation
+ * is only allowed if the actual
+ * value to be assigned is zero. This
+ * operator only exists to allow for
+ * the obvious notation
+ * <tt>matrix=0</tt>, which sets all
+ * elements of the matrix to zero,
+ * but keep the sparsity pattern
+ * previously used.
+ */
+ SparseMatrixEZ<number>& operator = (const double d);
+
/**
* Reinitialize the sparse matrix
* to the dimensions provided.
// $Id$
// Version: $Name$
//
-// Copyright (C) 2002, 2003 by the deal.II authors
+// Copyright (C) 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
}
+template <typename number>
+SparseMatrixEZ<number> &
+SparseMatrixEZ<number>::operator = (const double d)
+{
+ Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
+
+ typename std::vector<Entry>::iterator e = data.begin();
+ const typename std::vector<Entry>::iterator end = data.end();
+
+ while (e != end)
+ {
+ (e++)->value = 0.;
+ }
+
+ return *this;
+}
+
+
+
template <typename number>
void
SparseMatrixEZ<number>::reinit(const unsigned int n_rows,