FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
triple_dot_product_block_generic.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8#ifndef KERNEL_LAFEM_ARCH_TRIPLE_DOT_PRODUCT_BLOCK_HPP
9#error "Do not include this implementation-only header file directly!"
10#endif
11
12namespace FEAT::LAFEM::Arch
13{
14 template <typename ValueType_>
15 ValueType_ TripleDotProductBlock::exec_generic_impl(const ValueType_ * const x, const ValueType_ * const y, const ValueType_ * const z, const Index size)
16 {
17 ValueType_ r(0);
18
19 if (x == y)
20 {
21
22 for(Index i(0); i < size; ++i)
23 {
24 for(int j(0); j < ValueType_::n; ++j)
25 {
26 r[j] += x[i][j] * x[i][j] * z[i][j];
27 }
28 }
29 }
30 else if (x == z)
31 {
32
33 for (Index i(0) ; i < size ; ++i)
34 {
35 for(int j(0); j < ValueType_::n; ++j)
36 {
37 r[j] += x[i][j] * x[i][j] * y[i][j];
38 }
39 }
40 }
41 else if (y == z)
42 {
43
44 for (Index i(0) ; i < size ; ++i)
45 {
46 for(int j(0); j < ValueType_::n; ++j)
47 {
48 r[j] += x[i][j] * y[i][j] * y[i][j];
49 }
50 }
51 }
52 else
53 {
54
55 for(Index i(0); i < size; ++i)
56 {
57 for(int j(0); j < ValueType_::n; ++j)
58 {
59 r[j] += x[i][j] * y[i][j] * z[i][j];
60 }
61 }
62 }
63
64 return r;
65 }
66} // namespace FEAT::LAFEM::Arch
std::uint64_t Index
Index data type.