From: bangerth Date: Tue, 14 Aug 2012 06:58:05 +0000 (+0000) Subject: Let copy constructor from IdentityMatrix to FullMatrix not be explicit any more.... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3472221d90999c2b28cd7d81e8846946c9f4f1e0;p=dealii-svn.git Let copy constructor from IdentityMatrix to FullMatrix not be explicit any more. There doesn't appear to be a compelling reason for this. git-svn-id: https://svn.dealii.org/trunk@25961 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index a4751585b2..1c45b5f3cd 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -276,6 +276,12 @@ enabled due to a missing include file in file

Specific improvements

    +
  1. New: The copy constructor of FullMatrix from IdentityMatrix +used to be explicit, but that didn't appear to be necessary in hindsight. +Consequently, it is now a regular copy constructor. +
    +(Wolfgang Bangerth, 2012/08/14) +
  2. New: The Patterns::Map pattern allows to describe maps from keys to values in input files.
    diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index 6e33ecc93a..eab4bd0d8d 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -290,7 +290,7 @@ class FullMatrix : public Table<2,number> * FullMatrix M(IdentityMatrix(n)); * @endverbatim */ - explicit FullMatrix (const IdentityMatrix &id); + FullMatrix (const IdentityMatrix &id); /** * @} */ @@ -921,10 +921,12 @@ class FullMatrix : public Table<2,number> const unsigned int src_offset_j = 0); /** - * Adda single element at the + * Add a single element at the * given position. */ - void add(const unsigned int row, const unsigned int column, const number value); + void add (const unsigned int row, + const unsigned int column, + const number value); /** * Add an array of values given by diff --git a/tests/lac/identity_matrix_06.cc b/tests/lac/identity_matrix_06.cc new file mode 100644 index 0000000000..4478492088 --- /dev/null +++ b/tests/lac/identity_matrix_06.cc @@ -0,0 +1,81 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005, 2006, 2012 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- + +// check assignment from IdentityMatrix to FullMatrix using the syntax +// FullMatrix M = IdentityMatrix(4); +// this didn't work initially because the copy constructor in FullMatrix +// was explicit; however, in hindsight, I can't see a good reason for +// it to be explicit. + + +#include "../tests.h" +#include +#include +#include +#include + +#include +#include +#include + +template +void +check_vmult() +{ + FullMatrix M = IdentityMatrix(4); + Vector u(4); + Vector v(4); + + for (unsigned int i=0;i<4;++i) + u(i) = i+1; + + M.vmult(v,u); + Assert (v == u, ExcInternalError()); + for (unsigned int i=0;i(); + check_vmult(); +} diff --git a/tests/lac/identity_matrix_06/cmp/generic b/tests/lac/identity_matrix_06/cmp/generic new file mode 100644 index 0000000000..29bcfce3a3 --- /dev/null +++ b/tests/lac/identity_matrix_06/cmp/generic @@ -0,0 +1,9 @@ + +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4. +DEAL:: 1. 2. 3. 4.