FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
transpose_dense_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_TRANSPOSE_DENSE_HPP
9#error "Do not include this implementation-only header file directly!"
10#endif
11
12namespace FEAT::LAFEM::Arch
13{
15 template <typename DT_>
16 void TransposeDense::exec_generic_impl(DT_ * r, const DT_ * const x, const Index rows_x, const Index cols_x)
17 {
18 if (r == x)
19 {
21 DT_* t= new DT_[rows_x * cols_x];
22 Memory::memcopy_main(t, x, rows_x * cols_x * sizeof(DT_));
23 FEAT_PRAGMA_OMP(parallel for)
24 for (Index i = 0 ; i < rows_x ; ++i)
25 {
26 for (Index j = 0 ; j < cols_x ; ++j)
27 {
28 r[j * rows_x + i] = t[i * cols_x + j];
29 }
30 }
31 delete[] t;
32 }
33 else
34 {
35 FEAT_PRAGMA_OMP(parallel for)
36 for (Index i = 0 ; i < rows_x ; ++i)
37 {
38 for (Index j = 0 ; j < cols_x ; ++j)
39 {
40 r[j * rows_x + i] = x[i * cols_x + j];
41 }
42 }
43 }
44 }
45} // namespace FEAT::LAFEM::Arch
void memcopy_main(void *dst, const void *src, std::size_t bytes)
Copies a region of a main memory block into another main memory block.
std::uint64_t Index
Index data type.
static void exec_generic_impl(DT_ *r, const DT_ *const x, const Index rows_x, const Index cols_x)