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