FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
unit_filter_dense_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_UNIT_FILTER_DENSE_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 UnitFilterDenseCSR::exec_generic_impl(DT_* mat, const IT_* const row_ptr, const IT_* const col_idx, const IT_ * const f_idx, const Index f_nzes, const bool unit, const int block_width)
16 {
17 if(unit)
18 {
19 FEAT_PRAGMA_OMP(parallel for)
20 for(Index i = 0; i < f_nzes; ++i)
21 {
22 const IT_ ix(f_idx[i]);
23 for(IT_ j(row_ptr[ix]); j < row_ptr[ix + 1]; ++j)
24 {
25 mat[j] = (col_idx[j] == ix) ? DT_(1) : DT_(0);
26 }
27 }
28 }
29 else
30 {
31 FEAT_PRAGMA_OMP(parallel for)
32 for(Index i = 0; i < f_nzes; ++i)
33 {
34 const IT_ ix(f_idx[i]);
35 for(IT_ j(row_ptr[ix]); j < row_ptr[ix + 1]; ++j)
36 {
37 for(Index k = 0; k < Index(block_width); ++k)
38 mat[j*Index(block_width) + k] = DT_(0);
39 }
40 }
41 }
42 }
43} // namespace FEAT::LAFEM::Arch
std::uint64_t Index
Index data type.