From 59b54a5dc0b541b6ad2b0145f7adb178f0e49408 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 2 Jul 2013 19:10:53 +0000 Subject: [PATCH] Patch by Denis Davydov: Provide functions to unroll and re-roll indices of Tensor, much the same as we already have for SymmetricTensor. Add test. git-svn-id: https://svn.dealii.org/trunk@29918 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/tensor_24.cc | 56 ++++++++++++++++++++++++++++++++ tests/base/tensor_24/cmp/generic | 16 +++++++++ 2 files changed, 72 insertions(+) create mode 100644 tests/base/tensor_24.cc create mode 100644 tests/base/tensor_24/cmp/generic diff --git a/tests/base/tensor_24.cc b/tests/base/tensor_24.cc new file mode 100644 index 0000000000..70ea6057d5 --- /dev/null +++ b/tests/base/tensor_24.cc @@ -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 +#include +#include +#include +#include + + +template +void check () +{ + typedef Tensor<2,dim> S; + for (unsigned int i=0; i (); + 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 index 0000000000..b19d2b3e7e --- /dev/null +++ b/tests/base/tensor_24/cmp/generic @@ -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 -- 2.39.5