FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
slip_filter_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_SLIP_FILTER_GENERIC_HPP
8#define KERNEL_LAFEM_ARCH_SLIP_FILTER_GENERIC_HPP 1
9
10#ifndef KERNEL_LAFEM_ARCH_SLIP_FILTER_HPP
11#error "Do not include this implementation-only header file directly!"
12#endif
13
15namespace FEAT
16{
17 namespace LAFEM
18 {
19 namespace Arch
20 {
21 template <int BlockSize_, typename DT_, typename IT_>
22 void SlipFilter::filter_rhs_generic(DT_ * v, const DT_ * const nu_elements, const IT_ * const sv_indices, const Index ue)
23 {
24 Index block_size = Index(BlockSize_);
25 FEAT_PRAGMA_OMP(parallel for)
26 for(Index i = 0; i < ue; ++i)
27 {
28 DT_ sp(DT_(0));
29 DT_ scal(DT_(0));
30 for(Index j = 0 ; j < block_size ; ++j)
31 {
32 sp += v[block_size * sv_indices[i] + j] *nu_elements[block_size * i + j];
33 scal += nu_elements[block_size * i + j]*nu_elements[block_size * i + j];
34 }
35
36 sp /= scal;
37
38 for(Index j = 0 ; j < block_size ; ++j)
39 v[block_size * sv_indices[i] + j] -= sp*nu_elements[block_size * i + j];
40 }
41 }
42
43 template <int BlockSize_, typename DT_, typename IT_>
44 void SlipFilter::filter_def_generic(DT_ * v, const DT_* const nu_elements, const IT_ * const sv_indices, const Index ue)
45 {
46 Index block_size = Index(BlockSize_);
47 FEAT_PRAGMA_OMP(parallel for)
48 for(Index i = 0; i < ue; ++i)
49 {
50 DT_ sp(DT_(0));
51 DT_ scal(DT_(0));
52 for(Index j = 0 ; j < block_size ; ++j)
53 {
54 sp += v[block_size * sv_indices[i] + j] *nu_elements[block_size * i + j];
55 scal += nu_elements[block_size * i + j]*nu_elements[block_size * i + j];
56 }
57
58 sp /= scal;
59
60 for(Index j = 0 ; j < block_size ; ++j)
61 v[block_size * sv_indices[i] + j] -= sp*nu_elements[block_size * i + j];
62 }
63 }
64
65 } // namespace Arch
66 } // namespace LAFEM
67} // namespace FEAT
69
70#endif // KERNEL_LAFEM_ARCH_SLIP_FILTER_GENERIC_HPP
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.