From: Wolfgang Bangerth Date: Fri, 8 Jul 2016 20:10:29 +0000 (-0500) Subject: Add a test for MemoryConsumption of SymmetricTensor objects. X-Git-Tag: v8.5.0-rc1~896^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec1ddac12d754dab09fecf0c2c68674da68e9181;p=dealii.git Add a test for MemoryConsumption of SymmetricTensor objects. --- diff --git a/tests/base/symmetric_tensor_31.cc b/tests/base/symmetric_tensor_31.cc new file mode 100644 index 0000000000..5a0cb87b60 --- /dev/null +++ b/tests/base/symmetric_tensor_31.cc @@ -0,0 +1,54 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 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. +// +// --------------------------------------------------------------------- + +// Test SymmetricTensor::memory_consumption + +#include "../tests.h" +#include +#include +#include + + +template +void check () +{ + deallog << "dim=" << dim << ", T=double " + << MemoryConsumption::memory_consumption (SymmetricTensor()) + << std::endl; + deallog << "dim=" << dim << ", T=complex " + << MemoryConsumption::memory_consumption (SymmetricTensor >()) + << std::endl; +} + + +int main () +{ + std::ofstream logfile("output"); + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.threshold_double(1.e-10); + + deallog << "check rank 2 tensors" << std::endl; + check<2,1>(); + check<2,2>(); + check<2,3>(); + + deallog << "check rank 4 tensors" << std::endl; + check<4,1>(); + check<4,2>(); + check<4,3>(); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/symmetric_tensor_31.output b/tests/base/symmetric_tensor_31.output new file mode 100644 index 0000000000..b1425dfe58 --- /dev/null +++ b/tests/base/symmetric_tensor_31.output @@ -0,0 +1,16 @@ + +DEAL::check rank 2 tensors +DEAL::dim=1, T=double 8 +DEAL::dim=1, T=complex 16 +DEAL::dim=2, T=double 24 +DEAL::dim=2, T=complex 48 +DEAL::dim=3, T=double 48 +DEAL::dim=3, T=complex 96 +DEAL::check rank 4 tensors +DEAL::dim=1, T=double 8 +DEAL::dim=1, T=complex 16 +DEAL::dim=2, T=double 72 +DEAL::dim=2, T=complex 144 +DEAL::dim=3, T=double 288 +DEAL::dim=3, T=complex 576 +DEAL::OK