Alamo
Matrix3.H
Go to the documentation of this file.
1#ifndef SET_MATRIX3_H
2#define SET_MATRIX3_H
3
4#include "Set/Base.H"
5
6namespace Set
7{
8class Matrix3
9{
10public:
13 Scalar & operator () (const int i, const int j, const int k)
14 {
15 return data[i](j,k);
16 }
18 const Scalar & operator () (const int i, const int j, const int k) const
19 {
20 return data[i](j,k);
21 }
23 Matrix & operator [] (const int i)
24 {
25 return data[i];
26 }
27
30 {
31 Set::Scalar ret = 0.0;
32 for (int i = 0 ; i < AMREX_SPACEDIM; i++) ret += data[i].squaredNorm();
33 return sqrt(ret);
34 }
35
36 //AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator = (Matrix3 a) {for (int i = 0; i < AMREX_SPACEDIM; i++) data[i] = a.data[i];}
41
42 static Matrix3 Zero()
43 {
45 for (int i = 0; i < AMREX_SPACEDIM; i++) ret.data[i] = Set::Matrix::Zero();
46 return ret;
47 }
48 static Matrix3 Random()
49 {
51 for (int i = 0; i < AMREX_SPACEDIM; i++) ret.data[i] = Set::Matrix::Random();
52 return ret;
53 }
54
55};
56}
57#endif
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator*=(Set::Scalar alpha)
Definition Matrix3.H:39
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Scalar & operator()(const int i, const int j, const int k)
Definition Matrix3.H:13
static Matrix3 Zero()
Definition Matrix3.H:42
static Matrix3 Random()
Definition Matrix3.H:48
Set::Matrix data[AMREX_SPACEDIM]
Definition Matrix3.H:11
AMREX_FORCE_INLINE Set::Scalar norm()
Definition Matrix3.H:29
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator-=(Matrix3 a)
Definition Matrix3.H:38
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator+=(Matrix3 a)
Definition Matrix3.H:37
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator/=(Set::Scalar alpha)
Definition Matrix3.H:40
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Matrix & operator[](const int i)
Definition Matrix3.H:23
A collection of data types and symmetry-reduced data structures.
Definition Base.H:18
amrex::Real Scalar
Definition Base.H:19
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, 1 > Vector
Definition Base.H:20
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, AMREX_SPACEDIM > Matrix
Definition Base.H:23