]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add comprehensive test for symmetric tensor constructor and initializer
authorJean-Paul Pelteret <jppelteret@gmail.com>
Tue, 15 Aug 2017 14:34:05 +0000 (08:34 -0600)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Tue, 15 Aug 2017 15:03:49 +0000 (09:03 -0600)
tests/base/symmetric_tensor_42.cc [new file with mode: 0644]
tests/base/symmetric_tensor_42.output [new file with mode: 0644]

diff --git a/tests/base/symmetric_tensor_42.cc b/tests/base/symmetric_tensor_42.cc
new file mode 100644 (file)
index 0000000..9e95cd8
--- /dev/null
@@ -0,0 +1,68 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// Verify that symmetric tensor construction and initialization
+// works as expected for non-trivial number types
+
+#include "../tests.h"
+#include <deal.II/base/symmetric_tensor.h>
+
+#include<complex>
+
+template <int dim, int rank,  typename NumberType>
+void test_constructor ()
+{
+  const SymmetricTensor<rank,dim,NumberType> t1;
+}
+
+template <int dim, int rank, typename NumberType, typename OtherNumberType>
+void test_initializer ()
+{
+  const SymmetricTensor<rank,dim,OtherNumberType> t1;
+  const SymmetricTensor<rank,dim,NumberType> t2 (t1);
+}
+
+template <int rank, typename NumberType, typename OtherNumberType>
+void test ()
+{
+  deallog << "constructor" << std::endl;
+  test_constructor<1,rank,NumberType> ();
+  test_constructor<2,rank,NumberType> ();
+  test_constructor<3,rank,NumberType> ();
+
+  deallog << "initializer" << std::endl;
+  test_initializer<1,rank,NumberType,OtherNumberType> ();
+  test_initializer<2,rank,NumberType,OtherNumberType> ();
+  test_initializer<3,rank,NumberType,OtherNumberType> ();
+}
+
+
+int main ()
+{
+  initlog();
+
+  deallog << "rank 2, double" << std::endl;
+  test<2, double, float >();
+  deallog << "rank 2, std::complex<double>" << std::endl;
+  test<2, std::complex<double>, std::complex<float> >();
+
+  deallog << "rank 4, double" << std::endl;
+  test<4, double, float >();
+  deallog << "rank 4, std::complex<double>" << std::endl;
+  test<4, std::complex<double>, std::complex<float> >();
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/base/symmetric_tensor_42.output b/tests/base/symmetric_tensor_42.output
new file mode 100644 (file)
index 0000000..19ec964
--- /dev/null
@@ -0,0 +1,14 @@
+
+DEAL::rank 2, double
+DEAL::constructor
+DEAL::initializer
+DEAL::rank 2, std::complex<double>
+DEAL::constructor
+DEAL::initializer
+DEAL::rank 4, double
+DEAL::constructor
+DEAL::initializer
+DEAL::rank 4, std::complex<double>
+DEAL::constructor
+DEAL::initializer
+DEAL::OK

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.