]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make IdentityMatrix constrcutor explicit
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 28 Jun 2018 14:08:03 +0000 (16:08 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 28 Jun 2018 14:08:03 +0000 (16:08 +0200)
include/deal.II/lac/identity_matrix.h
tests/lac/identity_matrix_07.cc [new file with mode: 0644]
tests/lac/identity_matrix_07.output [new file with mode: 0644]

index 0c1bdb85e625ded44eaa2e90caac04c1aa15b24d..e418b61d7a0cd3148a064cbdb292d2097dd8194a 100644 (file)
@@ -85,7 +85,7 @@ public:
   /**
    * Constructor. Creates a identity matrix of size #n.
    */
-  IdentityMatrix(const size_type n);
+  explicit IdentityMatrix(const size_type n);
 
   /**
    * Resize the matrix to be of size #n by #n.
diff --git a/tests/lac/identity_matrix_07.cc b/tests/lac/identity_matrix_07.cc
new file mode 100644 (file)
index 0000000..d4336f8
--- /dev/null
@@ -0,0 +1,35 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// Check that clearing a FullMatrix<Number> using a number type convertible to
+// Number is not ambiguous.
+
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/identity_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include "../tests.h"
+
+int
+main()
+{
+  initlog();
+  FullMatrix<std::complex<double>> matrix1;
+  matrix = 0.;
+
+  deallog << "OK" << std::endl;
+  return 0;
+}
diff --git a/tests/lac/identity_matrix_07.output b/tests/lac/identity_matrix_07.output
new file mode 100644 (file)
index 0000000..29bcfce
--- /dev/null
@@ -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.

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.