From 41b3d424d9c4a152ed2fcb689b177a95fd1a109f Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Tue, 8 Aug 2017 15:26:55 -0600 Subject: [PATCH] Add NumberType to CurlType. --- include/deal.II/fe/fe_values.h | 20 +++++------ tests/fe/fe_values_view_number_01.cc | 43 ++++++++++++++++++++++++ tests/fe/fe_values_view_number_01.output | 3 ++ 3 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 tests/fe/fe_values_view_number_01.cc create mode 100644 tests/fe/fe_values_view_number_01.output diff --git a/include/deal.II/fe/fe_values.h b/include/deal.II/fe/fe_values.h index 73cbefd5d2..d49cf35727 100644 --- a/include/deal.II/fe/fe_values.h +++ b/include/deal.II/fe/fe_values.h @@ -56,7 +56,7 @@ namespace internal * A class whose specialization is used to define what type the curl of a * vector valued function corresponds to. */ - template + template struct CurlType; /** @@ -65,10 +65,10 @@ namespace internal * * In 1d, the curl is a scalar. */ - template <> - struct CurlType<1> + template + struct CurlType<1, NumberType> { - typedef Tensor<1,1> type; + typedef Tensor<1,1,NumberType> type; }; /** @@ -77,10 +77,10 @@ namespace internal * * In 2d, the curl is a scalar. */ - template <> - struct CurlType<2> + template + struct CurlType<2,NumberType> { - typedef Tensor<1,1> type; + typedef Tensor<1,1,NumberType> type; }; /** @@ -89,10 +89,10 @@ namespace internal * * In 3d, the curl is a vector. */ - template <> - struct CurlType<3> + template + struct CurlType<3,NumberType> { - typedef Tensor<1,3> type; + typedef Tensor<1,3,NumberType> type; }; } diff --git a/tests/fe/fe_values_view_number_01.cc b/tests/fe/fe_values_view_number_01.cc new file mode 100644 index 0000000000..4d33b42c12 --- /dev/null +++ b/tests/fe/fe_values_view_number_01.cc @@ -0,0 +1,43 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2007 - 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. +// +// --------------------------------------------------------------------- + +// Check that we get the right type of CurlType with Custom number type. + +#include "../tests.h" +#include + +#include + + + +template +void test () +{ + if (typeid(typename internal::CurlType<1, Number>::type) != typeid(Tensor<1,1,Number>) ) + deallog << "NOT OK!" << std::endl; + if (typeid(typename internal::CurlType<2, Number>::type) != typeid(Tensor<1,1,Number>) ) + deallog << "NOT OK!" << std::endl; + if (typeid(typename internal::CurlType<3, Number>::type) != typeid(Tensor<1,3,Number>) ) + deallog << "NOT OK!" << std::endl; + deallog << "OK" << std::endl; +} + + +int main() +{ + initlog(); + test(); + test(); +} diff --git a/tests/fe/fe_values_view_number_01.output b/tests/fe/fe_values_view_number_01.output new file mode 100644 index 0000000000..8b3b075900 --- /dev/null +++ b/tests/fe/fe_values_view_number_01.output @@ -0,0 +1,3 @@ + +DEAL::OK +DEAL::OK -- 2.39.5