FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
unit_filter_block_vec_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_BLOCK_VEC_HPP
9#error "Do not include this implementation-only header file directly!"
10#endif
11
12#include <kernel/util/math.hpp>
13
14namespace FEAT::LAFEM::Arch
15{
16 template <typename DT_, typename IT_>
17 void UnitFilterBlockVec::exec_generic_impl(DT_ * v, const DT_ * const f_val, const IT_ * const f_idx, const Index f_nzes, const bool zero, const bool ign_nans, const int block_size)
18 {
19 FEAT_PRAGMA_OMP(parallel for)
20 for(Index i = 0; i < f_nzes; ++i)
21 {
22 for(int j = 0 ; j < block_size ; ++j)
23 {
24 const Index k = Index(block_size) * i + Index(j);
25
26 // skip if filter value is NaN if desired
27 if(ign_nans && Math::isnan(f_val[k]))
28 continue;
29
30 // write filter value or zero
31 v[Index(block_size) * f_idx[i] + Index(j)] = zero ? DT_(0) : f_val[k];
32 }
33 }
34 }
35} // namespace FEAT::LAFEM::Arch
bool isnan(T_ x)
Checks whether a value is Not-A-Number.
std::uint64_t Index
Index data type.