From da7faf894d0e313a8dbbe72d48f5db9c3c542f9a Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Sun, 13 Aug 2017 12:07:07 -0600 Subject: [PATCH] Moved Sacado product type header and moved Sacado tests --- include/deal.II/base/sacado_product_type.h | 170 +----------------- .../differentiation/sacado_product_types.h | 169 +++++++++++++++++ source/base/symmetric_tensor.cc | 2 +- source/fe/fe_values.cc | 2 +- ...w_get_function_from_local_dof_values_02.cc | 2 +- tests/sacado/CMakeLists.txt | 6 + .../sacado_product_type_01.cc | 2 +- .../sacado_product_type_01.output} | 0 .../sacado_product_type_02.cc | 2 +- .../sacado_product_type_02.output} | 0 .../sacado_product_type_03.cc | 2 +- .../sacado_product_type_03.output} | 0 .../sacado_product_type_04.cc | 2 +- .../sacado_product_type_04.output} | 0 .../sacado_product_type_05.cc | 2 +- .../sacado_product_type_05.output} | 0 .../sacado_product_type_06.cc | 2 +- .../sacado_product_type_06.output} | 0 .../sacado_product_type_07.cc | 2 +- .../sacado_product_type_07.output} | 0 .../sacado_product_type_08.cc | 2 +- .../sacado_product_type_08.output} | 0 .../sacado_product_type_09.cc | 2 +- .../sacado_product_type_09.output} | 0 24 files changed, 191 insertions(+), 178 deletions(-) create mode 100644 include/deal.II/differentiation/sacado_product_types.h create mode 100644 tests/sacado/CMakeLists.txt rename tests/{base => sacado}/sacado_product_type_01.cc (97%) rename tests/{base/sacado_product_type_01.with_trilinos=on.output => sacado/sacado_product_type_01.output} (100%) rename tests/{base => sacado}/sacado_product_type_02.cc (98%) rename tests/{base/sacado_product_type_02.with_trilinos=on.output => sacado/sacado_product_type_02.output} (100%) rename tests/{base => sacado}/sacado_product_type_03.cc (96%) rename tests/{base/sacado_product_type_03.with_trilinos=on.output => sacado/sacado_product_type_03.output} (100%) rename tests/{base => sacado}/sacado_product_type_04.cc (96%) rename tests/{base/sacado_product_type_04.with_trilinos=on.output => sacado/sacado_product_type_04.output} (100%) rename tests/{base => sacado}/sacado_product_type_05.cc (96%) rename tests/{base/sacado_product_type_05.with_trilinos=on.output => sacado/sacado_product_type_05.output} (100%) rename tests/{base => sacado}/sacado_product_type_06.cc (95%) rename tests/{base/sacado_product_type_06.with_trilinos=on.output => sacado/sacado_product_type_06.output} (100%) rename tests/{base => sacado}/sacado_product_type_07.cc (95%) rename tests/{base/sacado_product_type_07.with_trilinos=on.output => sacado/sacado_product_type_07.output} (100%) rename tests/{base => sacado}/sacado_product_type_08.cc (95%) rename tests/{base/sacado_product_type_08.with_trilinos=on.output => sacado/sacado_product_type_08.output} (100%) rename tests/{base => sacado}/sacado_product_type_09.cc (95%) rename tests/{base/sacado_product_type_09.with_trilinos=on.output => sacado/sacado_product_type_09.output} (100%) diff --git a/include/deal.II/base/sacado_product_type.h b/include/deal.II/base/sacado_product_type.h index f2e3a63b01..c6353daa1b 100644 --- a/include/deal.II/base/sacado_product_type.h +++ b/include/deal.II/base/sacado_product_type.h @@ -1,169 +1,7 @@ -// --------------------------------------------------------------------- -// -// 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. -// -// --------------------------------------------------------------------- +#ifndef dealii__sacado_product_type_h_deprecated +#define dealii__sacado_product_type_h_deprecated +#warning This file is deprecated. Use instead. -#ifndef dealii__sacado_product_type_h -#define dealii__sacado_product_type_h - -#include -#include -#include -#include - -#ifdef DEAL_II_WITH_TRILINOS - -DEAL_II_DISABLE_EXTRA_DIAGNOSTICS -# include -DEAL_II_ENABLE_EXTRA_DIAGNOSTICS - -DEAL_II_NAMESPACE_OPEN - -template -struct ProductType, float> -{ - typedef Sacado::Fad::DFad type; -}; - -template -struct ProductType > -{ - typedef Sacado::Fad::DFad type; -}; - -template -struct ProductType, double> -{ - typedef Sacado::Fad::DFad type; -}; - -template -struct ProductType > -{ - typedef Sacado::Fad::DFad type; -}; - -template -struct ProductType, int> -{ - typedef Sacado::Fad::DFad type; -}; - -template -struct ProductType > -{ - typedef Sacado::Fad::DFad type; -}; - -template -struct ProductType, Sacado::Fad::DFad > -{ - typedef Sacado::Fad::DFad::type > type; -}; - -template -struct EnableIfScalar > -{ - typedef Sacado::Fad::DFad type; -}; - - - -/** - * Compute the scalar product $a:b=\sum_{i,j} a_{ij}b_{ij}$ between two - * tensors $a,b$ of rank 2. We don't use operator* for this - * operation since the product between two tensors is usually assumed to be - * the contraction over the last index of the first tensor and the first index - * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. - * - * @relates Tensor @relates SymmetricTensor - */ -template -inline -Sacado::Fad::DFad -scalar_product (const SymmetricTensor<2,dim,Sacado::Fad::DFad > &t1, - const Tensor<2,dim,Number> &t2) -{ - Sacado::Fad::DFad s = 0; - for (unsigned int i=0; ioperator* for this - * operation since the product between two tensors is usually assumed to be - * the contraction over the last index of the first tensor and the first index - * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. - * - * @relates Tensor @relates SymmetricTensor - */ -template -inline -Sacado::Fad::DFad -scalar_product (const Tensor<2,dim,Number> &t1, - const SymmetricTensor<2,dim,Sacado::Fad::DFad > &t2) -{ - return scalar_product(t2, t1); -} - - -/** - * Compute the scalar product $a:b=\sum_{i,j} a_{ij}b_{ij}$ between two - * tensors $a,b$ of rank 2. We don't use operator* for this - * operation since the product between two tensors is usually assumed to be - * the contraction over the last index of the first tensor and the first index - * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. - * - * @relates Tensor @relates SymmetricTensor - */ -template -inline -Sacado::Fad::DFad -scalar_product (const SymmetricTensor<2,dim,Number> &t1, - const Tensor<2,dim,Sacado::Fad::DFad > &t2) -{ - Sacado::Fad::DFad s = 0; - for (unsigned int i=0; ioperator* for this - * operation since the product between two tensors is usually assumed to be - * the contraction over the last index of the first tensor and the first index - * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. - * - * @relates Tensor @relates SymmetricTensor - */ -template -inline -Sacado::Fad::DFad -scalar_product (const Tensor<2,dim,Sacado::Fad::DFad > &t1, - const SymmetricTensor<2,dim,Number> &t2) -{ - return scalar_product(t2, t1); -} - -DEAL_II_NAMESPACE_CLOSE - -#endif // DEAL_II_WITH_TRILINOS +# include #endif diff --git a/include/deal.II/differentiation/sacado_product_types.h b/include/deal.II/differentiation/sacado_product_types.h new file mode 100644 index 0000000000..03cf892e1d --- /dev/null +++ b/include/deal.II/differentiation/sacado_product_types.h @@ -0,0 +1,169 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + +#ifndef dealii__differentiation__sacado_product_types_h +#define dealii__differentiation__sacado_product_types_h + +#include +#include +#include +#include + +#ifdef DEAL_II_WITH_TRILINOS + +DEAL_II_DISABLE_EXTRA_DIAGNOSTICS +# include +DEAL_II_ENABLE_EXTRA_DIAGNOSTICS + +DEAL_II_NAMESPACE_OPEN + +template +struct ProductType, float> +{ + typedef Sacado::Fad::DFad type; +}; + +template +struct ProductType > +{ + typedef Sacado::Fad::DFad type; +}; + +template +struct ProductType, double> +{ + typedef Sacado::Fad::DFad type; +}; + +template +struct ProductType > +{ + typedef Sacado::Fad::DFad type; +}; + +template +struct ProductType, int> +{ + typedef Sacado::Fad::DFad type; +}; + +template +struct ProductType > +{ + typedef Sacado::Fad::DFad type; +}; + +template +struct ProductType, Sacado::Fad::DFad > +{ + typedef Sacado::Fad::DFad::type > type; +}; + +template +struct EnableIfScalar > +{ + typedef Sacado::Fad::DFad type; +}; + + + +/** + * Compute the scalar product $a:b=\sum_{i,j} a_{ij}b_{ij}$ between two + * tensors $a,b$ of rank 2. We don't use operator* for this + * operation since the product between two tensors is usually assumed to be + * the contraction over the last index of the first tensor and the first index + * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. + * + * @relates Tensor @relates SymmetricTensor + */ +template +inline +Sacado::Fad::DFad +scalar_product (const SymmetricTensor<2,dim,Sacado::Fad::DFad > &t1, + const Tensor<2,dim,Number> &t2) +{ + Sacado::Fad::DFad s = 0; + for (unsigned int i=0; ioperator* for this + * operation since the product between two tensors is usually assumed to be + * the contraction over the last index of the first tensor and the first index + * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. + * + * @relates Tensor @relates SymmetricTensor + */ +template +inline +Sacado::Fad::DFad +scalar_product (const Tensor<2,dim,Number> &t1, + const SymmetricTensor<2,dim,Sacado::Fad::DFad > &t2) +{ + return scalar_product(t2, t1); +} + + +/** + * Compute the scalar product $a:b=\sum_{i,j} a_{ij}b_{ij}$ between two + * tensors $a,b$ of rank 2. We don't use operator* for this + * operation since the product between two tensors is usually assumed to be + * the contraction over the last index of the first tensor and the first index + * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. + * + * @relates Tensor @relates SymmetricTensor + */ +template +inline +Sacado::Fad::DFad +scalar_product (const SymmetricTensor<2,dim,Number> &t1, + const Tensor<2,dim,Sacado::Fad::DFad > &t2) +{ + Sacado::Fad::DFad s = 0; + for (unsigned int i=0; ioperator* for this + * operation since the product between two tensors is usually assumed to be + * the contraction over the last index of the first tensor and the first index + * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. + * + * @relates Tensor @relates SymmetricTensor + */ +template +inline +Sacado::Fad::DFad +scalar_product (const Tensor<2,dim,Sacado::Fad::DFad > &t1, + const SymmetricTensor<2,dim,Number> &t2) +{ + return scalar_product(t2, t1); +} + +DEAL_II_NAMESPACE_CLOSE + +#endif // DEAL_II_WITH_TRILINOS + +#endif diff --git a/source/base/symmetric_tensor.cc b/source/base/symmetric_tensor.cc index ac21457526..787b037321 100644 --- a/source/base/symmetric_tensor.cc +++ b/source/base/symmetric_tensor.cc @@ -22,7 +22,7 @@ DEAL_II_DISABLE_EXTRA_DIAGNOSTICS # include DEAL_II_ENABLE_EXTRA_DIAGNOSTICS -#include +#include #endif #include diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index aa1cddfa30..dc3329a95d 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -39,7 +39,7 @@ #include #include -#include +#include DEAL_II_NAMESPACE_OPEN diff --git a/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc b/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc index fc268cfe7d..9ec99e04a8 100644 --- a/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc +++ b/tests/fe/fe_values_view_get_function_from_local_dof_values_02.cc @@ -25,7 +25,7 @@ #include "../tests.h" #include -#include +#include #include #include #include diff --git a/tests/sacado/CMakeLists.txt b/tests/sacado/CMakeLists.txt new file mode 100644 index 0000000000..d2d115e821 --- /dev/null +++ b/tests/sacado/CMakeLists.txt @@ -0,0 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) +INCLUDE(../setup_testsubproject.cmake) +PROJECT(testsuite CXX) +IF(DEAL_II_WITH_TRILINOS) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/base/sacado_product_type_01.cc b/tests/sacado/sacado_product_type_01.cc similarity index 97% rename from tests/base/sacado_product_type_01.cc rename to tests/sacado/sacado_product_type_01.cc index a56e2da7d8..da039d9e88 100644 --- a/tests/base/sacado_product_type_01.cc +++ b/tests/sacado/sacado_product_type_01.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_01.with_trilinos=on.output b/tests/sacado/sacado_product_type_01.output similarity index 100% rename from tests/base/sacado_product_type_01.with_trilinos=on.output rename to tests/sacado/sacado_product_type_01.output diff --git a/tests/base/sacado_product_type_02.cc b/tests/sacado/sacado_product_type_02.cc similarity index 98% rename from tests/base/sacado_product_type_02.cc rename to tests/sacado/sacado_product_type_02.cc index fda3f6b613..11133bf73c 100644 --- a/tests/base/sacado_product_type_02.cc +++ b/tests/sacado/sacado_product_type_02.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_02.with_trilinos=on.output b/tests/sacado/sacado_product_type_02.output similarity index 100% rename from tests/base/sacado_product_type_02.with_trilinos=on.output rename to tests/sacado/sacado_product_type_02.output diff --git a/tests/base/sacado_product_type_03.cc b/tests/sacado/sacado_product_type_03.cc similarity index 96% rename from tests/base/sacado_product_type_03.cc rename to tests/sacado/sacado_product_type_03.cc index 2481b819d4..024831bf90 100644 --- a/tests/base/sacado_product_type_03.cc +++ b/tests/sacado/sacado_product_type_03.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_03.with_trilinos=on.output b/tests/sacado/sacado_product_type_03.output similarity index 100% rename from tests/base/sacado_product_type_03.with_trilinos=on.output rename to tests/sacado/sacado_product_type_03.output diff --git a/tests/base/sacado_product_type_04.cc b/tests/sacado/sacado_product_type_04.cc similarity index 96% rename from tests/base/sacado_product_type_04.cc rename to tests/sacado/sacado_product_type_04.cc index 93ee01b66b..52400174f5 100644 --- a/tests/base/sacado_product_type_04.cc +++ b/tests/sacado/sacado_product_type_04.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_04.with_trilinos=on.output b/tests/sacado/sacado_product_type_04.output similarity index 100% rename from tests/base/sacado_product_type_04.with_trilinos=on.output rename to tests/sacado/sacado_product_type_04.output diff --git a/tests/base/sacado_product_type_05.cc b/tests/sacado/sacado_product_type_05.cc similarity index 96% rename from tests/base/sacado_product_type_05.cc rename to tests/sacado/sacado_product_type_05.cc index c85863d0a9..610c4342b1 100644 --- a/tests/base/sacado_product_type_05.cc +++ b/tests/sacado/sacado_product_type_05.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_05.with_trilinos=on.output b/tests/sacado/sacado_product_type_05.output similarity index 100% rename from tests/base/sacado_product_type_05.with_trilinos=on.output rename to tests/sacado/sacado_product_type_05.output diff --git a/tests/base/sacado_product_type_06.cc b/tests/sacado/sacado_product_type_06.cc similarity index 95% rename from tests/base/sacado_product_type_06.cc rename to tests/sacado/sacado_product_type_06.cc index 75c2db17b0..655521fa25 100644 --- a/tests/base/sacado_product_type_06.cc +++ b/tests/sacado/sacado_product_type_06.cc @@ -18,7 +18,7 @@ #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_06.with_trilinos=on.output b/tests/sacado/sacado_product_type_06.output similarity index 100% rename from tests/base/sacado_product_type_06.with_trilinos=on.output rename to tests/sacado/sacado_product_type_06.output diff --git a/tests/base/sacado_product_type_07.cc b/tests/sacado/sacado_product_type_07.cc similarity index 95% rename from tests/base/sacado_product_type_07.cc rename to tests/sacado/sacado_product_type_07.cc index 61bdea09ba..a4d05357b3 100644 --- a/tests/base/sacado_product_type_07.cc +++ b/tests/sacado/sacado_product_type_07.cc @@ -18,7 +18,7 @@ #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_07.with_trilinos=on.output b/tests/sacado/sacado_product_type_07.output similarity index 100% rename from tests/base/sacado_product_type_07.with_trilinos=on.output rename to tests/sacado/sacado_product_type_07.output diff --git a/tests/base/sacado_product_type_08.cc b/tests/sacado/sacado_product_type_08.cc similarity index 95% rename from tests/base/sacado_product_type_08.cc rename to tests/sacado/sacado_product_type_08.cc index 3ae15815fd..886464c743 100644 --- a/tests/base/sacado_product_type_08.cc +++ b/tests/sacado/sacado_product_type_08.cc @@ -18,7 +18,7 @@ #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_08.with_trilinos=on.output b/tests/sacado/sacado_product_type_08.output similarity index 100% rename from tests/base/sacado_product_type_08.with_trilinos=on.output rename to tests/sacado/sacado_product_type_08.output diff --git a/tests/base/sacado_product_type_09.cc b/tests/sacado/sacado_product_type_09.cc similarity index 95% rename from tests/base/sacado_product_type_09.cc rename to tests/sacado/sacado_product_type_09.cc index 65fa7878dd..caa41c8630 100644 --- a/tests/base/sacado_product_type_09.cc +++ b/tests/sacado/sacado_product_type_09.cc @@ -18,7 +18,7 @@ #include -#include +#include #include "../tests.h" diff --git a/tests/base/sacado_product_type_09.with_trilinos=on.output b/tests/sacado/sacado_product_type_09.output similarity index 100% rename from tests/base/sacado_product_type_09.with_trilinos=on.output rename to tests/sacado/sacado_product_type_09.output -- 2.39.5