OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
TSVMetaCross.h
Go to the documentation of this file.
1// -*- C++ -*-
2//-----------------------------------------------------------------------------
3// The IPPL Framework - Visit http://people.web.psi.ch/adelmann/ for more details
4//
5// This program was prepared by the Regents of the University of California at
6#ifndef TSV_META_CROSS_H
7#define TSV_META_CROSS_H
8
10//
11// Definition of the struct TSV_MetaCross.
12//
14
15template<class T1, class T2> struct TSV_MetaCross {};
16
18//
19// Specializations for Vektor cross Vektor
20//
22
23template<class T1, class T2, unsigned D>
24struct TSV_MetaCross< Vektor<T1,D> , Vektor<T2,D> >
25{
27 inline static Vektor<T0,D>
28 apply(const Vektor<T1,D>& /*a*/, const Vektor<T2,D>& /*b*/) {
29 ERRORMSG("Cross-product *only* implemented for 3D; you're trying to"
30 << " do it for " << D << "D." << endl);
31 Ippl::abortAllNodes("...aborting from cross()");
32 Vektor<T0,D> bogusCross(-99999);
33 return bogusCross;
34 }
35};
36
37template<class T1, class T2>
38struct TSV_MetaCross< Vektor<T1,3> , Vektor<T2,3> >
39{
41 inline static Vektor<T0,3>
42 apply(const Vektor<T1,3>& a, const Vektor<T2,3>& b) {
44 cross[0] = a[1]*b[2] - a[2]*b[1];
45 cross[1] = a[2]*b[0] - a[0]*b[2];
46 cross[2] = a[0]*b[1] - a[1]*b[0];
47 return cross;
48 }
49};
50
52
53#endif // TSV_META_CROSS_H
54
55// $(Id)
56
57/***************************************************************************
58 * $RCSfile: addheaderfooter,v $ $Author: adelmann $
59 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $
60 * IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $
61 ***************************************************************************/
62
Vector3D cross(const Vector3D &lhs, const Vector3D &rhs)
Vector cross product.
Definition: Vector3D.cpp:111
std::complex< double > a
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
#define ERRORMSG(msg)
Definition: IpplInfo.h:350
Definition: Vektor.h:32
static Vektor< T0, D > apply(const Vektor< T1, D > &, const Vektor< T2, D > &)
Definition: TSVMetaCross.h:28
PETEBinaryReturn< T1, T2, OpMultipply >::type T0
Definition: TSVMetaCross.h:26
static Vektor< T0, 3 > apply(const Vektor< T1, 3 > &a, const Vektor< T2, 3 > &b)
Definition: TSVMetaCross.h:42
PETEBinaryReturn< T1, T2, OpMultipply >::type T0
Definition: TSVMetaCross.h:40
PETE_ComputeBinaryType< T1, T2, Op, Op::tag >::type type
static void abortAllNodes(const char *=0)
Definition: IpplInfo.cpp:647