16 #ifndef dealii__constrained_linear_operator_h 17 #define dealii__constrained_linear_operator_h 19 #include <deal.II/lac/linear_operator.h> 20 #include <deal.II/lac/packaged_operation.h> 21 #include <deal.II/lac/constraint_matrix.h> 23 #ifdef DEAL_II_WITH_CXX11 25 DEAL_II_NAMESPACE_OPEN
63 template <
typename Range,
typename Domain>
70 return_op.
vmult_add = [&constraint_matrix](Range &v,
const Domain &u)
73 ::
ExcMessage(
"The domain and range vectors must be different " 74 "storage locations"));
76 for (
auto i : v.locally_owned_elements())
83 const auto pos = (*entries)[j].first;
84 v(i) += u(pos) * (*entries)[j].second;
92 return_op.
Tvmult_add = [&constraint_matrix](Domain &v,
const Range &u)
95 ::
ExcMessage(
"The domain and range vectors must be different " 96 "storage locations"));
98 for (
auto i : v.locally_owned_elements())
105 const auto pos = (*entries)[j].first;
106 v(pos) += u(i) * (*entries)[j].second;
115 const auto vmult_add = return_op.
vmult_add;
116 return_op.
vmult = [vmult_add](Range &v,
const Domain &u)
124 return_op.
Tvmult = [Tvmult_add](Domain &v,
const Range &u)
145 template <
typename Range,
typename Domain>
152 return_op.
vmult_add = [&constraint_matrix](Range &v,
const Domain &u)
154 for (
auto i : v.locally_owned_elements())
159 return_op.
Tvmult_add = [&constraint_matrix](Domain &v,
const Range &u)
161 for (
auto i : v.locally_owned_elements())
166 return_op.
vmult = [&constraint_matrix](Range &v,
const Domain &u)
169 ::
ExcMessage(
"The domain and range vectors must be different " 170 "storage locations"));
173 for (
auto i : v.locally_owned_elements())
178 return_op.
Tvmult = [&constraint_matrix](Domain &v,
const Range &u)
181 ::
ExcMessage(
"The domain and range vectors must be different " 182 "storage locations"));
184 for (
auto i : v.locally_owned_elements())
230 template <
typename Range,
typename Domain>
240 return Ct * linop * C + Id_c;
278 template <
typename Range,
typename Domain>
282 const Range &right_hand_side)
289 [&constraint_matrix, &linop, &right_hand_side](Range &v)
296 Domain *k = vector_memory.
alloc();
297 linop.reinit_domain_vector(*k,
false);
300 v += Ct * (right_hand_side - linop **k);
302 vector_memory.
free(k);
306 const auto apply_add = return_comp.
apply_add;
307 return_comp.
apply = [apply_add](Range &v)
318 DEAL_II_NAMESPACE_CLOSE
320 #endif // DEAL_II_WITH_CXX11 std::function< void(Range &v)> apply
LinearOperator< Range, Domain > project_to_constrained_linear_operator(const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &exemplar)
std::function< void(Range &v, bool omit_zeroing_entries)> reinit_vector
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(Domain &v, const Range &u)> Tvmult
LinearOperator< Domain, Range, Payload > transpose_operator(const LinearOperator< Range, Domain, Payload > &op)
static ::ExceptionBase & ExcMessage(std::string arg1)
LinearOperator< Range, Domain > constrained_linear_operator(const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &linop)
PackagedOperation< Range > constrained_right_hand_side(const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &linop, const Range &right_hand_side)
unsigned int global_dof_index
virtual VectorType * alloc()
#define Assert(cond, exc)
static bool equal(const T *p1, const T *p2)
std::function< void(Range &v, const Domain &u)> vmult
virtual void free(const VectorType *const)
std::function< void(Range &v)> apply_add
void distribute(VectorType &vec) const
std::function< void(Range &v, const Domain &u)> vmult_add
LinearOperator< Range, Domain > distribute_constraints_linear_operator(const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &exemplar)
const std::vector< std::pair< size_type, double > > * get_constraint_entries(const size_type line) const
bool is_constrained(const size_type index) const