FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
diagonal_csr_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_DIAGONAL_CSR_HPP
9#error "Do not include this implementation-only header file directly!"
10#endif
11
12namespace FEAT::LAFEM::Arch
13{
14 template <typename DT_, typename IT_>
15 void DiagonalCSR::exec_generic_impl(DT_ * diag, const DT_ * const val, const IT_ * const col_idx, const IT_ * const row_ptr, const Index rows)
16 {
17 FEAT_PRAGMA_OMP(parallel for)
18 for (Index row = 0; row < rows; row++)
19 {
20 diag[row] = DT_(0);
21 const Index end = row_ptr[row + 1];
22 for (Index j = row_ptr[row]; j < end; j++)
23 {
24 if (row == col_idx[j])
25 {
26 diag[row] = val[j];
27 break;
28 }
29 }
30 }
31 }
32} // namespace FEAT::LAFEM::Arch
std::uint64_t Index
Index data type.