15#ifndef dealii_constrained_linear_operator_h
16#define dealii_constrained_linear_operator_h
62template <
typename Range,
typename Domain,
typename Payload>
70 return_op.
vmult_add = [&constraints](Range &v,
const Domain &u) {
72 ::ExcMessage(
"The domain and range vectors must be different "
73 "storage locations"));
79 const auto &locally_owned_elements = v.locally_owned_elements();
80 for (
const auto &line : constraints.
get_lines())
82 const auto i = line.index;
83 if (locally_owned_elements.is_element(i))
86 const auto &entries = line.entries;
89 const auto pos = entries[j].first;
90 v(i) += u(pos) * entries[j].second;
98 return_op.
Tvmult_add = [&constraints](Domain &v,
const Range &u) {
100 ::ExcMessage(
"The domain and range vectors must be different "
101 "storage locations"));
107 const auto &locally_owned_elements = v.locally_owned_elements();
108 for (
const auto &line : constraints.
get_lines())
110 const auto i = line.index;
112 if (locally_owned_elements.is_element(i))
117 const auto &entries = line.entries;
120 const auto pos = entries[j].first;
121 if (locally_owned_elements.is_element(pos))
122 v(pos) += u(i) * entries[j].second;
155template <
typename Range,
typename Domain,
typename Payload>
163 return_op.
vmult_add = [&constraints](Range &v,
const Domain &u) {
164 const auto &locally_owned_elements = v.locally_owned_elements();
165 for (
const auto &line : constraints.
get_lines())
167 const auto i = line.index;
168 if (locally_owned_elements.is_element(i))
177 return_op.
Tvmult_add = [&constraints](Domain &v,
const Range &u) {
178 const auto &locally_owned_elements = v.locally_owned_elements();
179 for (
const auto &line : constraints.
get_lines())
181 const auto i = line.index;
182 if (locally_owned_elements.is_element(i))
243template <
typename Range,
typename Domain,
typename Payload>
252 return Ct * linop * C + Id_c;
289template <
typename Range,
typename Domain,
typename Payload>
294 const Range &right_hand_side)
300 return_comp.
apply_add = [&constraints, &linop, &right_hand_side](Range &v) {
309 v += Ct * (right_hand_side - linop * *k);
312 return_comp.
apply = [apply_add = return_comp.
apply_add](Range &v) {
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)