From: alberto sartori Date: Wed, 23 Sep 2015 15:36:06 +0000 (+0200) Subject: removed overloads X-Git-Tag: v8.4.0-rc2~371^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1657%2Fhead;p=dealii.git removed overloads --- diff --git a/include/deal.II/base/sacado_product_type.h b/include/deal.II/base/sacado_product_type.h index e5c3de993d..1cf1973a5f 100644 --- a/include/deal.II/base/sacado_product_type.h +++ b/include/deal.II/base/sacado_product_type.h @@ -72,58 +72,6 @@ struct EnableIfScalar > typedef Sacado::Fad::DFad type; }; - -/** - * Provide an operator* for a scalar multiplication of a - * sacado type with a different non-sacado type. - * - * @relates EnableIfScalar - * @relates ProductType - */ - -template -typename ProductType, typename EnableIfScalar::type>::type -inline -operator*(const Sacado::Fad::DFad &left, const U &right) -{ - typedef typename ProductType, U>::type result_type; - return static_cast(left) * static_cast(right); -} - - -/** - * Provide an operator* for a scalar multiplication of non-sacado type with a sacado type. - * - * @relates EnableIfScalar - * @relates ProductType - */ - -template -typename ProductType::type, Sacado::Fad::DFad >::type -inline -operator*(const T &left, const Sacado::Fad::DFad &right) -{ - typedef typename ProductType >::type result_type; - return static_cast(left) * static_cast(right); -} - -/** - * Provide an operator* for a scalar multiplication of mixed - * sacado types. - * - * @relates EnableIfScalar - * @relates ProductType - */ - -template -typename ProductType, Sacado::Fad::DFad >::type -inline -operator*(const Sacado::Fad::DFad &left, const Sacado::Fad::DFad &right) -{ - typedef typename ProductType, Sacado::Fad::DFad >::type result_type; - return static_cast(left) * static_cast(right); -} - #endif // DEAL_II_WITH_TRILINOS DEAL_II_NAMESPACE_CLOSE diff --git a/tests/base/sacado_product_type_01.cc b/tests/base/sacado_product_type_01.cc index 3db0e57184..62711572e7 100644 --- a/tests/base/sacado_product_type_01.cc +++ b/tests/base/sacado_product_type_01.cc @@ -32,8 +32,6 @@ void check() { AssertThrow (typeid(typename ProductType::type) == typeid(CompareType), ExcInternalError()); - AssertThrow (typeid(typename ProductType::type) == typeid(T() * U()), - ExcInternalError()); } diff --git a/tests/base/sacado_product_type_02.cc b/tests/base/sacado_product_type_02.cc index 573e60876c..0fb703f6d5 100644 --- a/tests/base/sacado_product_type_02.cc +++ b/tests/base/sacado_product_type_02.cc @@ -32,8 +32,6 @@ void check() { AssertThrow (typeid(typename ProductType::type) == typeid(CompareType), ExcInternalError()); - AssertThrow (typeid(typename ProductType::type) == typeid(T() * U()), - ExcInternalError()); } diff --git a/tests/base/sacado_product_type_03.cc b/tests/base/sacado_product_type_03.cc index 680be7bde4..76742fbcf0 100644 --- a/tests/base/sacado_product_type_03.cc +++ b/tests/base/sacado_product_type_03.cc @@ -32,8 +32,6 @@ void check() { AssertThrow (typeid(typename ProductType::type) == typeid(CompareType), ExcInternalError()); - AssertThrow (typeid(typename ProductType::type) == typeid(T() * U()), - ExcInternalError()); } diff --git a/tests/base/sacado_product_type_04.cc b/tests/base/sacado_product_type_04.cc new file mode 100644 index 0000000000..d6f1088ee4 --- /dev/null +++ b/tests/base/sacado_product_type_04.cc @@ -0,0 +1,76 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 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 ProductType with sacado + +#include +#include +#include +#include +#include + +#include +#include + +#include "../tests.h" + +template +void check() +{ + AssertThrow (typeid(typename ProductType::type) == typeid(CompareType), + ExcInternalError()); +} + + +int main() +{ + typedef Sacado::Fad::DFad Sdouble; + typedef Sacado::Fad::DFad SSdouble; + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + + // check product with Tensor<1,dim> + check,Tensor<1,2,Sdouble>,Sdouble >(); + check,Tensor<1,2,SSdouble>,SSdouble >(); + + Tensor<1,2,SSdouble> t1; + Tensor<1,2,SSdouble> t2; + SSdouble a(2,0,7.0); + SSdouble b(2,1,3.0); + SSdouble c; + a.val() = Sdouble(2,0,7.0); + b.val() = Sdouble(2,1,3.0); + + for (unsigned int i=0; i<2; ++i) + { + t1[i] = 2.*a+i; + t2[i] = 3.*b-i; + } + const Tensor<1,2,SSdouble> t3=t2; + t1 *t2; + + t2 += a*t1; + + c = 0; + c += (a*b + 0.5*(t3*t3 + t1*t2))*0.3; + + + + deallog << "OK" << std::endl; +} diff --git a/tests/base/sacado_product_type_04.with_trilinos.output b/tests/base/sacado_product_type_04.with_trilinos.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/sacado_product_type_04.with_trilinos.output @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/base/sacado_product_type_05.cc b/tests/base/sacado_product_type_05.cc new file mode 100644 index 0000000000..fb1702e6eb --- /dev/null +++ b/tests/base/sacado_product_type_05.cc @@ -0,0 +1,74 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 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 ProductType with sacado + +#include +#include +#include +#include +#include + +#include +#include + +#include "../tests.h" + +template +void check() +{ + AssertThrow (typeid(typename ProductType::type) == typeid(CompareType), + ExcInternalError()); +} + + +int main() +{ + typedef Sacado::Fad::DFad Sdouble; + typedef Sacado::Fad::DFad SSdouble; + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + + // check product with Tensor<2,dim> + check,Tensor<1,2,Sdouble>,Sdouble >(); + check,Tensor<1,2,SSdouble>,SSdouble >(); + check,Tensor<2,2,Sdouble>,Tensor<2,2,Sdouble> >(); + check,Tensor<2,2,SSdouble>,Tensor<2,2,SSdouble> >(); + + Tensor<2,2,SSdouble> t1; + Tensor<2,2,SSdouble> t2; + SSdouble a(2,0,7.0); + SSdouble b(2,1,3.0); + SSdouble c; + a.val() = Sdouble(2,0,7.0); + b.val() = Sdouble(2,1,3.0); + + for (unsigned int i=0; i<2; ++i) + for (unsigned int j=0; j<2; ++j) + { + t1[i][j] = 2.*a+i*j; + t2[i][j] = 3.*b-i+j; + } + t1 *t2; + + t2 += a*t1; + + + deallog << "OK" << std::endl; +} diff --git a/tests/base/sacado_product_type_05.with_trilinos.output b/tests/base/sacado_product_type_05.with_trilinos.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/sacado_product_type_05.with_trilinos.output @@ -0,0 +1,2 @@ + +DEAL::OK