]> https://gitweb.dealii.org/ - dealii.git/commitdiff
removed overloads 1657/head
authoralberto sartori <alberto.sartori86@gmail.com>
Wed, 23 Sep 2015 15:36:06 +0000 (17:36 +0200)
committeralberto sartori <alberto.sartori86@gmail.com>
Wed, 23 Sep 2015 16:05:24 +0000 (18:05 +0200)
include/deal.II/base/sacado_product_type.h
tests/base/sacado_product_type_01.cc
tests/base/sacado_product_type_02.cc
tests/base/sacado_product_type_03.cc
tests/base/sacado_product_type_04.cc [new file with mode: 0644]
tests/base/sacado_product_type_04.with_trilinos.output [new file with mode: 0644]
tests/base/sacado_product_type_05.cc [new file with mode: 0644]
tests/base/sacado_product_type_05.with_trilinos.output [new file with mode: 0644]

index e5c3de993dd681c696acd731c67d372ef3e0cdba..1cf1973a5ff8fdee1e40f7fd969be407457327aa 100644 (file)
@@ -72,58 +72,6 @@ struct EnableIfScalar<Sacado::Fad::DFad<T> >
   typedef Sacado::Fad::DFad<T> type;
 };
 
-
-/**
- * Provide an <tt>operator*</tt> for a scalar multiplication of a
- * sacado type with a different non-sacado type.
- *
- * @relates EnableIfScalar
- * @relates ProductType
- */
-
-template <typename T, typename U>
-typename ProductType<Sacado::Fad::DFad<T>, typename EnableIfScalar<U>::type>::type
-inline
-operator*(const Sacado::Fad::DFad<T> &left, const U &right)
-{
-  typedef typename ProductType<Sacado::Fad::DFad<T>, U>::type result_type;
-  return static_cast<result_type>(left) * static_cast<result_type>(right);
-}
-
-
-/**
- * Provide an <tt>operator*</tt> for a scalar multiplication of non-sacado type with a sacado type.
- *
- * @relates EnableIfScalar
- * @relates ProductType
- */
-
-template <typename T, typename U>
-typename ProductType<typename EnableIfScalar<T>::type, Sacado::Fad::DFad<U> >::type
-inline
-operator*(const T &left, const Sacado::Fad::DFad<U> &right)
-{
-  typedef typename ProductType<T, Sacado::Fad::DFad<U> >::type result_type;
-  return static_cast<result_type>(left) * static_cast<result_type>(right);
-}
-
-/**
- * Provide an <tt>operator*</tt> for a scalar multiplication of mixed
- * sacado types.
- *
- * @relates EnableIfScalar
- * @relates ProductType
- */
-
-template <typename T, typename U>
-typename ProductType<Sacado::Fad::DFad<T>, Sacado::Fad::DFad<U> >::type
-inline
-operator*(const Sacado::Fad::DFad<T> &left, const Sacado::Fad::DFad<U> &right)
-{
-  typedef typename ProductType<Sacado::Fad::DFad<T>, Sacado::Fad::DFad<U> >::type result_type;
-  return static_cast<result_type>(left) * static_cast<result_type>(right);
-}
-
 #endif // DEAL_II_WITH_TRILINOS
 
 DEAL_II_NAMESPACE_CLOSE
index 3db0e57184e8aa6baf441366e01608dd8c71bc40..62711572e719a4b3cd3768658134ee41e84c6250 100644 (file)
@@ -32,8 +32,6 @@ void check()
 {
   AssertThrow (typeid(typename ProductType<T,U>::type) == typeid(CompareType),
                ExcInternalError());
-  AssertThrow (typeid(typename ProductType<T,U>::type) == typeid(T() * U()),
-               ExcInternalError());
 }
 
 
index 573e60876cd9930602608f1531287d1ac3c2cff3..0fb703f6d58279d597209d77ca3a783aae1f0681 100644 (file)
@@ -32,8 +32,6 @@ void check()
 {
   AssertThrow (typeid(typename ProductType<T,U>::type) == typeid(CompareType),
                ExcInternalError());
-  AssertThrow (typeid(typename ProductType<T,U>::type) == typeid(T() * U()),
-               ExcInternalError());
 }
 
 
index 680be7bde49da1ff07fe172b9a11184f041d98de..76742fbcf03dfe3f477b2cb1988ae67f3518f6f2 100644 (file)
@@ -32,8 +32,6 @@ void check()
 {
   AssertThrow (typeid(typename ProductType<T,U>::type) == typeid(CompareType),
                ExcInternalError());
-  AssertThrow (typeid(typename ProductType<T,U>::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 (file)
index 0000000..d6f1088
--- /dev/null
@@ -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 <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+#include <typeinfo>
+
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/sacado_product_type.h>
+
+#include "../tests.h"
+
+template <typename T, typename U, typename CompareType>
+void check()
+{
+  AssertThrow (typeid(typename ProductType<T,U>::type) == typeid(CompareType),
+               ExcInternalError());
+}
+
+
+int main()
+{
+  typedef Sacado::Fad::DFad<double> Sdouble;
+  typedef Sacado::Fad::DFad<Sdouble> 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>,Tensor<1,2,Sdouble>,Sdouble >();
+  check<Tensor<1,2,SSdouble>,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 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -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 (file)
index 0000000..fb1702e
--- /dev/null
@@ -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 <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+#include <typeinfo>
+
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/sacado_product_type.h>
+
+#include "../tests.h"
+
+template <typename T, typename U, typename CompareType>
+void check()
+{
+  AssertThrow (typeid(typename ProductType<T,U>::type) == typeid(CompareType),
+               ExcInternalError());
+}
+
+
+int main()
+{
+  typedef Sacado::Fad::DFad<double> Sdouble;
+  typedef Sacado::Fad::DFad<Sdouble> 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>,Tensor<1,2,Sdouble>,Sdouble >();
+  check<Tensor<1,2,SSdouble>,Tensor<1,2,SSdouble>,SSdouble  >();
+  check<Tensor<2,2,Sdouble>,Tensor<2,2,Sdouble>,Tensor<2,2,Sdouble> >();
+  check<Tensor<2,2,SSdouble>,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 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.