]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Patch by Denis Davydov: Provide functions to unroll and re-roll indices of Tensor...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 2 Jul 2013 19:10:53 +0000 (19:10 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 2 Jul 2013 19:10:53 +0000 (19:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@29918 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/tensor_24.cc [new file with mode: 0644]
tests/base/tensor_24/cmp/generic [new file with mode: 0644]

diff --git a/tests/base/tensor_24.cc b/tests/base/tensor_24.cc
new file mode 100644 (file)
index 0000000..70ea605
--- /dev/null
@@ -0,0 +1,56 @@
+//----------------------------  tensor_24.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2006, 2008, 2009 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.
+//
+//----------------------------  tensor_24.cc  ---------------------------
+
+// check Tensor<2,dim>::component_to_unrolled_index and the
+// other way round
+
+#include "../tests.h"
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/vector.h>
+#include <fstream>
+#include <iomanip>
+
+
+template <int dim>
+void check ()
+{
+  typedef Tensor<2,dim> S;
+  for (unsigned int i=0; i<S::n_independent_components; ++i)
+    {
+      deallog << i << "  --  "
+             << S::unrolled_to_component_indices (i)
+             << std::endl;
+      Assert (S::component_to_unrolled_index
+             (S::unrolled_to_component_indices (i))
+             ==
+             i,
+             ExcInternalError());
+    }
+}
+
+
+int main ()
+{
+  std::ofstream logfile("tensor_24/output");
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  check<1> ();
+  check<2> ();
+  check<3> ();
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/base/tensor_24/cmp/generic b/tests/base/tensor_24/cmp/generic
new file mode 100644 (file)
index 0000000..b19d2b3
--- /dev/null
@@ -0,0 +1,16 @@
+
+DEAL::0  --  [0,0]
+DEAL::0  --  [0,0]
+DEAL::1  --  [0,1]
+DEAL::2  --  [1,0]
+DEAL::3  --  [1,1]
+DEAL::0  --  [0,0]
+DEAL::1  --  [0,1]
+DEAL::2  --  [0,2]
+DEAL::3  --  [1,0]
+DEAL::4  --  [1,1]
+DEAL::5  --  [1,2]
+DEAL::6  --  [2,0]
+DEAL::7  --  [2,1]
+DEAL::8  --  [2,2]
+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.