FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
component_product_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#ifndef KERNEL_LAFEM_ARCH_COMPONENT_PRODUCT_GENERIC_HPP
8#define KERNEL_LAFEM_ARCH_COMPONENT_PRODUCT_GENERIC_HPP 1
9
10#ifndef KERNEL_LAFEM_ARCH_COMPONENT_PRODUCT_HPP
11#error "Do not include this implementation-only header file directly!"
12#endif
13
14namespace FEAT
15{
16 namespace LAFEM
17 {
18 namespace Arch
19 {
20
21 template <typename DT_>
22 void ComponentProduct::value_generic(DT_ * r, const DT_ * const x, const DT_ * const y, const Index size)
23 {
24 if (r == x)
25 {
26 FEAT_PRAGMA_OMP(parallel for)
27 for (Index i = 0 ; i < size ; ++i)
28 {
29 r[i] *= y[i];
30 }
31 }
32 else if (r == y)
33 {
34 FEAT_PRAGMA_OMP(parallel for)
35 for (Index i = 0 ; i < size ; ++i)
36 {
37 r[i] *= x[i];
38 }
39 }
40 else if (r == x && r == y)
41 {
42 FEAT_PRAGMA_OMP(parallel for)
43 for (Index i = 0 ; i < size ; ++i)
44 {
45 r[i] *= r[i];
46 }
47 }
48 else
49 {
50 FEAT_PRAGMA_OMP(parallel for)
51 for (Index i = 0 ; i < size ; ++i)
52 {
53 r[i] = x[i] * y[i];
54 }
55 }
56 }
57 } // namespace Arch
58 } // namespace LAFEM
59} // namespace FEAT
60
61#endif // KERNEL_LAFEM_ARCH_COMPONENT_PRODUCT_GENERIC_HPP
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.