19template<
class value_type>
24 value_type t00, value_type t01,
25 value_type t10, value_type t11,
26 value_type in0, value_type in1,
28 value_type& out0, value_type& out1)
const
30 value_type tmp0 = DG_FMA(t00,in0 , t01*in1);
31 value_type tmp1 = DG_FMA(t10,in0 , t11*in1);
32 value_type temp = out1*mu;
33 out1 = DG_FMA( lambda, tmp1, temp);
35 out0 = DG_FMA( lambda, tmp0, temp);
39template<
class value_type>
43 value_type t00, value_type t01, value_type t02,
44 value_type t10, value_type t11, value_type t12,
45 value_type t20, value_type t21, value_type t22,
46 value_type in0, value_type in1, value_type in2,
48 value_type& out0, value_type& out1, value_type& out2)
const
50 value_type tmp0 = DG_FMA( t00,in0 , (DG_FMA( t01,in1 , t02*in2)));
51 value_type tmp1 = DG_FMA( t10,in0 , (DG_FMA( t11,in1 , t12*in2)));
52 value_type tmp2 = DG_FMA( t20,in0 , (DG_FMA( t21,in1 , t22*in2)));
53 value_type temp = out2*mu;
54 out2 = DG_FMA( lambda, tmp2, temp);
56 out1 = DG_FMA( lambda, tmp1, temp);
58 out0 = DG_FMA( lambda, tmp0, temp);
62template<
class value_type>
66 value_type t00, value_type t01,
67 value_type t10, value_type t11,
68 value_type in0, value_type in1,
69 value_type mu, value_type& out0, value_type& out1)
const
71 value_type dett = DG_FMA( t00,t11 , (-t10*t01));
72 value_type tmp0 = DG_FMA( in0,t11 , (-in1*t01));
73 value_type tmp1 = DG_FMA( t00,in1 , (-t10*in0));
74 value_type temp = out1*mu;
75 out1 = DG_FMA( lambda, tmp1/dett, temp);
77 out0 = DG_FMA( lambda, tmp0/dett, temp);
81template<
class value_type>
85 value_type t00, value_type t01, value_type t02,
86 value_type t10, value_type t11, value_type t12,
87 value_type t20, value_type t21, value_type t22,
88 value_type in0, value_type in1, value_type in2,
90 value_type& out0, value_type& out1, value_type& out2)
const
92 value_type dett = det( t00,t01,t02, t10,t11,t12, t20,t21,t22);
94 value_type tmp0 = det( in0,t01,t02, in1,t11,t12, in2,t21,t22);
95 value_type tmp1 = det( t00,in0,t02, t10,in1,t12, t20,in2,t22);
96 value_type tmp2 = det( t00,t01,in0, t10,t11,in1, t20,t21,in2);
97 value_type temp = out2*mu;
98 out2 = DG_FMA( lambda, tmp2/dett, temp);
100 out1 = DG_FMA( lambda, tmp1/dett, temp);
102 out0 = DG_FMA( lambda, tmp0/dett, temp);
106 value_type det( value_type t00, value_type t01, value_type t02,
107 value_type t10, value_type t11, value_type t12,
108 value_type t20, value_type t21, value_type t22)
const
110 return t00*DG_FMA(t11, t22, (-t12*t21))
111 -t01*DG_FMA(t10, t22, (-t20*t12))
112 +t02*DG_FMA(t10, t21, (-t20*t11));
121template<
class value_type>
126 value_type v0, value_type v1,
127 value_type t00, value_type t01,
128 value_type t10, value_type t11,
130 value_type w0, value_type w1
133 value_type tmp0 = DG_FMA(t00,w0 , t01*w1);
134 value_type tmp1 = DG_FMA(t10,w0 , t11*w1);
135 return lambda*mu*DG_FMA(v0,tmp0 , v1*tmp1);
139template<
class value_type>
144 value_type v0, value_type v1, value_type v2,
145 value_type t00, value_type t01, value_type t02,
146 value_type t10, value_type t11, value_type t12,
147 value_type t20, value_type t21, value_type t22,
149 value_type w0, value_type w1, value_type w2)
const
151 value_type tmp0 = DG_FMA( t00,w0 , (DG_FMA( t01,w1 , t02*w2)));
152 value_type tmp1 = DG_FMA( t10,w0 , (DG_FMA( t11,w1 , t12*w2)));
153 value_type tmp2 = DG_FMA( t20,w0 , (DG_FMA( t21,w1 , t22*w2)));
154 return lambda*mu*DG_FMA(v0,tmp0 , DG_FMA(v1,tmp1 , v2*tmp2));
159template<
class value_type>
164 value_type t10, value_type t11)
const
166 return DG_FMA( t00,t11 , (-t10*t01));
170template<
class value_type>
174 value_type
operator() ( value_type t00, value_type t01, value_type t02,
175 value_type t10, value_type t11, value_type t12,
176 value_type t20, value_type t21, value_type t22)
const
178 return t00*m_t(t11, t12, t21, t22)
179 -t01*m_t(t10, t12, t20, t22)
180 +t02*m_t(t10, t11, t20, t21);
206template<
class ContainerType0,
class ContainerType1>
209 unsigned size=t.
values().size();
210 for(
unsigned i=0; i<size; i++)
229template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerTypeM,
class ContainerType3,
class ContainerType4>
230void multiply2d(
const ContainerTypeL& lambda,
const SparseTensor<ContainerType0>& t,
const ContainerType1& in0,
const ContainerType2& in1,
const ContainerTypeM& mu, ContainerType3& out0, ContainerType4& out1)
255template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerTypeM,
class ContainerType4,
class ContainerType5,
class ContainerType6>
256void multiply3d(
const ContainerTypeL& lambda,
const SparseTensor<ContainerType0>& t,
const ContainerType1& in0,
const ContainerType2& in1,
const ContainerType3& in2,
const ContainerTypeM& mu, ContainerType4& out0, ContainerType5& out1, ContainerType6& out2)
263 mu, out0, out1, out2);
281template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerTypeM,
class ContainerType3,
class ContainerType4>
308template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerTypeM,
class ContainerType4,
class ContainerType5,
class ContainerType6>
309void inv_multiply3d(
const ContainerTypeL& lambda,
const SparseTensor<ContainerType0>& t,
const ContainerType1& in0,
const ContainerType2& in1,
const ContainerType3& in2,
const ContainerTypeM& mu, ContainerType4& out0, ContainerType5& out1, ContainerType6& out2)
316 mu, out0, out1, out2);
328template<
class ContainerType>
331 ContainerType det = t.
value(0,0);
348template<
class ContainerType>
351 ContainerType det = t.
value(0,0);
378template<
class ContainerType>
405template<
class ContainerType>
427template<
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerType4>
447template<
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerType4,
class ContainerType5,
class ContainerType6>
448void multiply3d(
const SparseTensor<ContainerType0>& t,
const ContainerType1& in0,
const ContainerType2& in1,
const ContainerType3& in2, ContainerType4& out0, ContainerType5& out1, ContainerType6& out2)
450 multiply3d( 1., t, in0, in1, in2, 0., out0, out1, out2);
465template<
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerType4>
486template<
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerType4,
class ContainerType5,
class ContainerType6>
509template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerTypeM,
class ContainerType4,
class ContainerType5>
512 const ContainerTypeL& lambda,
513 const ContainerType0& v0,
514 const ContainerType1& v1,
516 const ContainerTypeM& mu,
517 const ContainerType3& w0,
518 const ContainerType4& w1,
551template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1,
class ContainerType2,
class ContainerType3,
class ContainerTypeM,
class ContainerType4,
class ContainerType5,
class ContainerType6,
class ContainerType7>
554 const ContainerTypeL& lambda,
555 const ContainerType0& v0,
556 const ContainerType1& v1,
557 const ContainerType2& v2,
559 const ContainerTypeM& mu,
560 const ContainerType4& w0,
561 const ContainerType5& w1,
562 const ContainerType6& w2,
#define DG_DEVICE
Expands to __host__ __device__ if compiled with nvcc else is empty.
Definition: functions.h:9
void transform(const ContainerType1 &x, ContainerType &y, UnaryOp op)
Definition: blas1.h:524
void subroutine(Subroutine f, ContainerType &&x, ContainerTypes &&... xs)
; Customizable and generic blas1 function
Definition: blas1.h:618
void evaluate(ContainerType &y, BinarySubroutine f, Functor g, const ContainerType0 &x0, const ContainerTypes &...xs)
Definition: blas1.h:556
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
void inv_multiply3d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, const ContainerTypeM &mu, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2)
i
Definition: multiply.h:309
ContainerType determinant2d(const SparseTensor< ContainerType > &t)
Definition: multiply.h:329
void scalar_product2d(get_value_type< ContainerType0 > alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const SparseTensor< ContainerType2 > &t, const ContainerTypeM &mu, const ContainerType3 &w0, const ContainerType4 &w1, get_value_type< ContainerType0 > beta, ContainerType5 &y)
Definition: multiply.h:510
void inv_multiply2d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerTypeM &mu, ContainerType3 &out0, ContainerType4 &out1)
Definition: multiply.h:282
void multiply2d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerTypeM &mu, ContainerType3 &out0, ContainerType4 &out1)
Definition: multiply.h:230
ContainerType determinant(const SparseTensor< ContainerType > &t)
Definition: multiply.h:349
ContainerType volume(const SparseTensor< ContainerType > &t)
Definition: multiply.h:406
void multiply3d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, const ContainerTypeM &mu, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2)
Definition: multiply.h:256
void scal(SparseTensor< ContainerType0 > &t, const ContainerType1 &mu)
Definition: multiply.h:207
ContainerType volume2d(const SparseTensor< ContainerType > &t)
Definition: multiply.h:379
void scalar_product3d(get_value_type< ContainerType0 > alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const ContainerType2 &v2, const SparseTensor< ContainerType3 > &t, const ContainerTypeM &mu, const ContainerType4 &w0, const ContainerType5 &w1, const ContainerType6 &w2, get_value_type< ContainerType0 > beta, ContainerType7 &y)
Definition: multiply.h:552
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Definition: subroutines.h:245
Definition: functors.h:124
Definition: multiply.h:63
DG_DEVICE void operator()(value_type lambda, value_type t00, value_type t01, value_type t10, value_type t11, value_type in0, value_type in1, value_type mu, value_type &out0, value_type &out1) const
Definition: multiply.h:65
Definition: multiply.h:82
DG_DEVICE void operator()(value_type lambda, value_type t00, value_type t01, value_type t02, value_type t10, value_type t11, value_type t12, value_type t20, value_type t21, value_type t22, value_type in0, value_type in1, value_type in2, value_type mu, value_type &out0, value_type &out1, value_type &out2) const
Definition: multiply.h:84
Class for 2x2 and 3x3 matrices sharing elements.
Definition: tensor.h:66
std::vector< container > & values()
Return write access to the values array.
Definition: tensor.h:166
const container & value(size_t i, size_t j) const
Read access the underlying container.
Definition: tensor.h:156
Definition: multiply.h:161
DG_DEVICE value_type operator()(value_type t00, value_type t01, value_type t10, value_type t11) const
Definition: multiply.h:163
Definition: multiply.h:172
DG_DEVICE value_type operator()(value_type t00, value_type t01, value_type t02, value_type t10, value_type t11, value_type t12, value_type t20, value_type t21, value_type t22) const
Definition: multiply.h:174
Definition: multiply.h:122
DG_DEVICE value_type operator()(value_type lambda, value_type v0, value_type v1, value_type t00, value_type t01, value_type t10, value_type t11, value_type mu, value_type w0, value_type w1) const
Definition: multiply.h:124
Definition: multiply.h:140
DG_DEVICE value_type operator()(value_type lambda, value_type v0, value_type v1, value_type v2, value_type t00, value_type t01, value_type t02, value_type t10, value_type t11, value_type t12, value_type t20, value_type t21, value_type t22, value_type mu, value_type w0, value_type w1, value_type w2) const
Definition: multiply.h:142
Definition: multiply.h:20
DG_DEVICE void operator()(value_type lambda, value_type t00, value_type t01, value_type t10, value_type t11, value_type in0, value_type in1, value_type mu, value_type &out0, value_type &out1) const
Definition: multiply.h:22
Definition: multiply.h:40
DG_DEVICE void operator()(value_type lambda, value_type t00, value_type t01, value_type t02, value_type t10, value_type t11, value_type t12, value_type t20, value_type t21, value_type t22, value_type in0, value_type in1, value_type in2, value_type mu, value_type &out0, value_type &out1, value_type &out2) const
Definition: multiply.h:42
Definition: subroutines.h:22