-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoperator.h
More file actions
68 lines (53 loc) · 1.64 KB
/
operator.h
File metadata and controls
68 lines (53 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// ---------------------------------------------------------------------
//
// Copyright (C) 2014 - 2019 by the BEMStokes authors.
//
// This file is part of the BEMStokes library.
//
// The BEMStokes is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License version 2.1 as published by the Free Software Foundation.
// The full text of the license can be found in the file LICENSE at
// the top level of the BEMStokes distribution.
//
// Authors: Nicola Giuliani, Luca Heltai, Antonio DeSimone
//
// ---------------------------------------------------------------------
DEAL_II_NAMESPACE_OPEN
template <typename number> class VEC;
template<class VEC, class MATRIX>
class CustomOperator
{
public:
CustomOperator(const VEC &pv, const VEC &dpv, const double norm, const MATRIX &m):
proj_vec(pv),
dual_proj_vec(dpv),
proj_vec_norm(norm),
matrix(m)
{}
void projector(const VEC &src, VEC &dst) const;
void vmult(VEC dst, const VEC &src) const;
private:
const VEC &proj_vec;
const VEC &dual_proj_vec;
const double proj_vec_norm;
const MATRIX &matrix;
};
template<class VEC, class MATRIX>
void CustomOperator<VEC, MATRIX>::projector(const VEC &src, VEC &dst) const
{
dst.sadd(0.,1.,src);
dst.sadd(1., -(dual_proj_vec*src)/proj_vec_norm, proj_vec);
return;
}
template<class VEC, class MATRIX>
void CustomOperator<VEC, MATRIX>::vmult(VEC dst, const VEC &src) const
{
VEC foo(src.locally_owned_elements(), src.get_mpi_communicator() );
projector(src, foo);
matrix.vmult(dst, foo);
foo = 0.;
projector(dst, foo);
dst = foo;
}
DEAL_II_NAMESPACE_CLOSE