OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
OPALTypes.h
Go to the documentation of this file.
1#ifndef OPAL_TYPES_HH
2#define OPAL_TYPES_HH
3
4#include "Ippl.h"
5
6#include <mpi.h>
7#include <Kokkos_MathematicalConstants.hpp>
8#include <Kokkos_MathematicalFunctions.hpp>
9#include <Kokkos_Random.hpp>
10#include <csignal>
11#include <random>
12#include <set>
13#include <string>
14#include <thread>
15#include <vector>
16#include <chrono>
17#include <iostream>
18#include <string>
19
20#include "PartBunch/datatypes.h"
21#include "Manager/PicManager.h"
22#include "PartBunch/PartBunch.h"
23
25
26template <typename T, unsigned Dim>
27using Vector_t = ippl::Vector<T, Dim>;
28
29typedef typename std::pair<Vector_t<double, 3>, Vector_t<double, 3>> VectorPair_t;
30
31enum UnitState_t { units = 0, unitless = 1 };
32
33// euclidean norm
34template <class T, unsigned D>
35KOKKOS_INLINE_FUNCTION double euclidean_norm(const Vector_t<T, D>& v) {
36 return Kokkos::sqrt(dot(v, v).apply());
37}
38
39// dot products
40template <class T, unsigned D>
41KOKKOS_INLINE_FUNCTION double dot(const Vector_t<T, D>& v, const Vector_t<T, D>& w) {
42 double res = 0.0;
43 for (unsigned i = 0; i < D; i++)
44 res += v(i) * w(i);
45 return res;
46}
47
48template <class T, unsigned D>
49KOKKOS_INLINE_FUNCTION double dot(const Vector_t<T, D>& v) {
50 double res = 0.0;
51 for (unsigned i = 0; i < D; i++)
52 res += v(i) * v(i);
53 return res;
54}
55#endif
PartBunch< PLayout_t< double, 3 >, double, 3 > PartBunch_t
std::pair< Vector_t< double, 3 >, Vector_t< double, 3 > > VectorPair_t
ippl::Vector< T, Dim > Vector_t
KOKKOS_INLINE_FUNCTION double dot(const Vector_t< T, D > &v, const Vector_t< T, D > &w)
Definition OPALTypes.h:41
UnitState_t
Definition OPALTypes.h:31
@ units
Definition OPALTypes.h:31
@ unitless
Definition OPALTypes.h:31
KOKKOS_INLINE_FUNCTION double euclidean_norm(const Vector_t< T, D > &v)
Definition OPALTypes.h:35