]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Small test program to assist the development of the tensor classes.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 5 Nov 1998 18:34:30 +0000 (18:34 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 5 Nov 1998 18:34:30 +0000 (18:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@636 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/tensor.cc [new file with mode: 0644]

diff --git a/tests/base/tensor.cc b/tests/base/tensor.cc
new file mode 100644 (file)
index 0000000..3c030bb
--- /dev/null
@@ -0,0 +1,27 @@
+#include <base/tensor.h>
+#include <iostream>
+
+int main () {
+  const unsigned int dim=3;
+  
+  Tensor<2,dim> t;
+  Tensor<2,dim> tt;
+
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      cout << i << ' ' << j << ':' << t[i][j] << endl;
+  cout << "----------------------------" << endl;
+       
+  t[0][0] = 1;
+  t[0][1] = 2;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      cout << i << ' ' << j << ':' << t[i][j] << endl;
+  cout << "----------------------------" << endl;
+
+  contract (tt,t,t);
+
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      cout << i << ' ' << j << ':' << tt[i][j] << endl;
+};

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.