Skip to content
Snippets Groups Projects
Commit ed3a7bbf authored by Elias Pipping's avatar Elias Pipping
Browse files

crossProduct moved to dune-matrix-vector

parent 1888608d
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <dune/istl/scaledidmatrix.hh> #include <dune/istl/scaledidmatrix.hh>
#include <dune/matrix-vector/axpy.hh> #include <dune/matrix-vector/axpy.hh>
#include <dune/matrix-vector/crossproduct.hh>
#include <dune/matrix-vector/transpose.hh> #include <dune/matrix-vector/transpose.hh>
#include <dune/solvers/common/resize.hh> #include <dune/solvers/common/resize.hh>
...@@ -145,32 +146,6 @@ namespace Arithmetic ...@@ -145,32 +146,6 @@ namespace Arithmetic
template <bool Condition, typename Type=void> template <bool Condition, typename Type=void>
using enable_if_t = typename std::enable_if<Condition, Type>::type; using enable_if_t = typename std::enable_if<Condition, Type>::type;
//! Helper class for computing the cross product
template <class T, int n>
struct CrossProductHelper
{
static Dune::FieldVector<T,n> crossProduct(const Dune::FieldVector<T,n>& a, const Dune::FieldVector<T,n>& b)
{
DUNE_UNUSED_PARAMETER(a);
DUNE_UNUSED_PARAMETER(b);
DUNE_THROW(Dune::Exception, "You can only call crossProduct with dim==3");
}
};
//! Specialisation for n=3
template <class T>
struct CrossProductHelper<T,3>
{
static Dune::FieldVector<T,3> crossProduct(const Dune::FieldVector<T,3>& a, const Dune::FieldVector<T,3>& b)
{
Dune::FieldVector<T,3> r;
r[0] = a[1]*b[2] - a[2]*b[1];
r[1] = a[2]*b[0] - a[0]*b[2];
r[2] = a[0]*b[1] - a[1]*b[0];
return r;
}
};
template <class MatrixType> template <class MatrixType>
using Transposed = typename Dune::MatrixVector::Transposed<MatrixType>; using Transposed = typename Dune::MatrixVector::Transposed<MatrixType>;
...@@ -212,7 +187,7 @@ namespace Arithmetic ...@@ -212,7 +187,7 @@ namespace Arithmetic
template<class T, int n> template<class T, int n>
Dune::FieldVector<T,n> crossProduct(const Dune::FieldVector<T,n>& a, const Dune::FieldVector<T,n>& b) Dune::FieldVector<T,n> crossProduct(const Dune::FieldVector<T,n>& a, const Dune::FieldVector<T,n>& b)
{ {
return CrossProductHelper<T,n>::crossProduct(a,b); return Dune::MatrixVector::crossProduct(a,b);
} }
//! Compute the transposed of a matrix //! Compute the transposed of a matrix
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment