16#ifndef dealii_constrained_linear_operator_h
17#define dealii_constrained_linear_operator_h
63template <
typename Range,
typename Domain,
typename Payload>
71 return_op.
vmult_add = [&constraints](Range &v,
const Domain &u) {
73 ::ExcMessage(
"The domain and range vectors must be different "
74 "storage locations"));
80 const auto &locally_owned_elements = v.locally_owned_elements();
81 for (
const auto &line : constraints.
get_lines())
83 const auto i = line.index;
84 if (locally_owned_elements.is_element(i))
87 const auto &entries = line.entries;
90 const auto pos = entries[j].first;
91 v(i) += u(pos) * entries[j].second;
99 return_op.
Tvmult_add = [&constraints](Domain &v,
const Range &u) {
101 ::ExcMessage(
"The domain and range vectors must be different "
102 "storage locations"));
108 const auto &locally_owned_elements = v.locally_owned_elements();
109 for (
const auto &line : constraints.
get_lines())
111 const auto i = line.index;
113 if (locally_owned_elements.is_element(i))
118 const auto &entries = line.entries;
121 const auto pos = entries[j].first;
122 if (locally_owned_elements.is_element(pos))
123 v(pos) += u(i) * entries[j].second;
156template <
typename Range,
typename Domain,
typename Payload>
164 return_op.
vmult_add = [&constraints](Range &v,
const Domain &u) {
165 const auto &locally_owned_elements = v.locally_owned_elements();
166 for (
const auto &line : constraints.
get_lines())
168 const auto i = line.index;
169 if (locally_owned_elements.is_element(i))
178 return_op.
Tvmult_add = [&constraints](Domain &v,
const Range &u) {
179 const auto &locally_owned_elements = v.locally_owned_elements();
180 for (
const auto &line : constraints.
get_lines())
182 const auto i = line.index;
183 if (locally_owned_elements.is_element(i))
244template <
typename Range,
typename Domain,
typename Payload>
253 return Ct * linop * C + Id_c;
290template <
typename Range,
typename Domain,
typename Payload>
295 const Range & right_hand_side)
301 return_comp.
apply_add = [&constraints, &linop, &right_hand_side](Range &v) {
310 v += Ct * (right_hand_side - linop * *k);
313 return_comp.
apply = [apply_add = return_comp.
apply_add](Range &v) {
const LineRange get_lines() const
void distribute(VectorType &vec) const
std::function< void(Range &v, const Domain &u)> vmult_add
std::function< void(Domain &v, const Range &u)> Tvmult
std::function< void(Domain &v, bool omit_zeroing_entries)> reinit_domain_vector
std::function< void(Range &v, const Domain &u)> vmult
std::function< void(Range &v, bool omit_zeroing_entries)> reinit_range_vector
std::function< void(Domain &v, const Range &u)> Tvmult_add
std::function< void(Range &v, bool omit_zeroing_entries)> reinit_vector
std::function< void(Range &v)> apply
std::function< void(Range &v)> apply_add
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
LinearOperator< Domain, Range, Payload > transpose_operator(const LinearOperator< Range, Domain, Payload > &op)
PackagedOperation< Range > constrained_right_hand_side(const AffineConstraints< typename Range::value_type > &constraints, const LinearOperator< Range, Domain, Payload > &linop, const Range &right_hand_side)
LinearOperator< Range, Domain, Payload > constrained_linear_operator(const AffineConstraints< typename Range::value_type > &constraints, const LinearOperator< Range, Domain, Payload > &linop)
LinearOperator< Range, Domain, Payload > project_to_constrained_linear_operator(const AffineConstraints< typename Range::value_type > &constraints, const LinearOperator< Range, Domain, Payload > &exemplar)
LinearOperator< Range, Domain, Payload > distribute_constraints_linear_operator(const AffineConstraints< typename Range::value_type > &constraints, const LinearOperator< Range, Domain, Payload > &exemplar)
static bool equal(const T *p1, const T *p2)