3#ifndef DUNE_PDELAB_COMMON_CROSSPRODUCT_HH
4#define DUNE_PDELAB_COMMON_CROSSPRODUCT_HH
25 template<
unsigned dimB_,
unsigned dimC_>
28 "CrossProduct cannot be used unspecialized");
31 static const unsigned dimA;
33 static const unsigned dimB;
35 static const unsigned dimC;
38 template<
typename AType,
typename BType,
typename CType>
59 static const unsigned dimA = 3;
61 static const unsigned dimB = 3;
63 static const unsigned dimC = 3;
66 template<
typename AType,
typename BType,
typename CType>
68 for(
unsigned i = 0; i < 3; ++i) {
71 A[i] = B[j]*C[k] - B[k]*C[j];
97 struct CrossProduct<2, 2> {
99 static const unsigned dimA = 1;
101 static const unsigned dimB = 2;
103 static const unsigned dimC = 2;
106 template<
typename AType,
typename BType,
typename CType>
107 CrossProduct(AType& A,
const BType& B,
const CType& C) {
108 A[0] = B[0]*C[1] - B[1]*C[0];
134 struct CrossProduct<2, 1> {
136 static const unsigned dimA = 2;
138 static const unsigned dimB = 2;
140 static const unsigned dimC = 1;
143 template<
typename AType,
typename BType,
typename CType>
144 CrossProduct(AType& A,
const BType& B,
const CType& C) {
172 struct CrossProduct<1, 2> {
174 static const unsigned dimA = 2;
176 static const unsigned dimB = 1;
178 static const unsigned dimC = 2;
181 template<
typename AType,
typename BType,
typename CType>
182 CrossProduct(AType& A,
const BType& B,
const CType& C) {
202 template<
typename T,
int dimB,
int dimC>
203 void crossproduct(
const FieldVector<T, dimB>& b,
204 const FieldVector<T, dimC>& c,
206 CrossProduct<dimB,dimC>(a,b,c);
213 template<
typename T,
int dimB,
int dimC>
214 FieldVector<T, CrossProduct<dimB, dimC>::dimA>
215 crossproduct(
const FieldVector<T, dimB>& b,
216 const FieldVector<T, dimC>& c) {
217 FieldVector<T, CrossProduct<dimB, dimC>::dimA> a;
Calculate cross product.
Definition: crossproduct.hh:26
static const unsigned dimB
dimension of
Definition: crossproduct.hh:33
static const unsigned dimC
dimension of
Definition: crossproduct.hh:35
CrossProduct(AType &A, const BType &B, const CType &C)
calculate cross product of B and C
static const unsigned dimA
dimension of
Definition: crossproduct.hh:31
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:13
template which always yields a false value
Definition: typetraits.hh:124