FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
diagonal_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_DIAGONAL_GENERIC_HPP
8#define KERNEL_LAFEM_ARCH_DIAGONAL_GENERIC_HPP 1
9
10#ifndef KERNEL_LAFEM_ARCH_DIAGONAL_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 template <typename IT_>
21 void Diagonal::csr_generic(IT_ * diag, const IT_ * const col_ind, const IT_ * const row_ptr, const Index rows)
22 {
23 FEAT_PRAGMA_OMP(parallel for)
24 for (Index row = 0; row < rows; row++)
25 {
26 const Index end = row_ptr[row + 1];
27 diag[row] = row_ptr[rows];
28 for (Index col = row_ptr[row]; col < end; col++)
29 {
30 if (row == col_ind[col])
31 {
32 diag[row] = IT_(col);
33 break;
34 }
35 }
36 }
37 }
38 } // namespace Arch
39 } // namespace LAFEM
40} // namespace FEAT
41
42#endif // KERNEL_LAFEM_ARCH_DIAGONAL_GENERIC_HPP
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.