From 504420e770294f3189cd9af45d42124c50b781cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@mi.fu-berlin.de> Date: Tue, 8 Sep 2009 20:39:52 +0000 Subject: [PATCH] Moved to dune-solvers. We don't need it in ag-common. [[Imported from SVN: r2809]] --- dune-solvers/computeenergy.hh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 dune-solvers/computeenergy.hh diff --git a/dune-solvers/computeenergy.hh b/dune-solvers/computeenergy.hh new file mode 100644 index 00000000..a3595989 --- /dev/null +++ b/dune-solvers/computeenergy.hh @@ -0,0 +1,26 @@ +#ifndef CONTACT_COMPUTE_ENERGY_HH +#define CONTACT_COMPUTE_ENERGY_HH + +template <class M, class V> +double computeEnergy(const M& mat, const V& x, const V& rhs) +{ + V tmp(x.size()); + tmp = 0; + mat.umv(x, tmp); + +// std::cout << "tmp*x: " << (tmp*x) << " rhs*x: " << (rhs*x) << std::endl; +// exit(0); + return 0.5*(tmp*x) - rhs*x; +} + +template <class M, class V> +double computeEnergy(const M& mat, const V& x) +{ + V tmp(x.size()); + tmp = 0; + mat.umv(x, tmp); + + return 0.5*(tmp*x); +} + +#endif -- GitLab