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>
289template <
typename Range,
typename Domain,
typename Payload>
306 linop.reinit_domain_vector(*
k,
false);
307 constraints.distribute(*
k);
#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)