15#ifndef dealii_packaged_operation_h
16#define dealii_packaged_operation_h
30template <
typename Number>
32template <
typename Range,
typename Domain,
typename Payload>
34template <
typename Range = Vector<
double>>
103template <
typename Range>
114 apply = [](Range &) {
117 "Uninitialized PackagedOperation<Range>::apply called"));
123 "Uninitialized PackagedOperation<Range>::apply_add called"));
128 ExcMessage(
"Uninitialized PackagedOperation<Range>::reinit_vector "
170 apply = [&u](Range &v) { v = u; };
175 v.reinit(u, omit_zeroing_entries);
187 operator Range()
const
192 apply(result_vector);
194 return result_vector;
208 *
this = *
this + second_comp;
219 *
this = *
this - second_comp;
251 *
this = *
this * number;
260 std::function<void(Range &v)>
apply;
292template <
typename Range>
304 return_comp.
apply = [first_comp, second_comp](Range &v) {
309 return_comp.
apply_add = [first_comp, second_comp](Range &v) {
325template <
typename Range>
337 return_comp.
apply = [first_comp, second_comp](Range &v) {
338 second_comp.
apply(v);
343 return_comp.
apply_add = [first_comp, second_comp](Range &v) {
361template <
typename Range>
364 typename Range::value_type number)
373 return_comp.
apply = [](Range &v) { v = 0.; };
379 return_comp.
apply = [comp, number](Range &v) {
384 return_comp.
apply_add = [comp, number](Range &v) {
402template <
typename Range>
407 return comp * number;
418template <
typename Range>
433template <
typename Range>
448template <
typename Range>
465template <
typename Range>
482 namespace PackagedOperationImplementation
488 template <
typename T>
491 template <
typename C>
492 static std::false_type
495 template <
typename C>
496 static std::true_type
498 decltype(&C::operator-=),
499 decltype(&C::l2_norm));
527 typename = std::enable_if_t<internal::PackagedOperationImplementation::
528 has_vector_interface<Range>::type::value>>
537 return_comp.
reinit_vector = [&u](Range &x,
bool omit_zeroing_entries) {
538 x.reinit(u, omit_zeroing_entries);
541 return_comp.
apply = [&u, &v](Range &x) {
546 return_comp.
apply_add = [&u, &v](Range &x) {
572 typename = std::enable_if_t<internal::PackagedOperationImplementation::
573 has_vector_interface<Range>::type::value>>
582 return_comp.
reinit_vector = [&u](Range &x,
bool omit_zeroing_entries) {
583 x.reinit(u, omit_zeroing_entries);
586 return_comp.
apply = [&u, &v](Range &x) {
591 return_comp.
apply_add = [&u, &v](Range &x) {
616 typename = std::enable_if_t<internal::PackagedOperationImplementation::
617 has_vector_interface<Range>::type::value>>
619operator*(
const Range &u,
typename Range::value_type number)
641 typename = std::enable_if_t<internal::PackagedOperationImplementation::
642 has_vector_interface<Range>::type::value>>
644operator*(
typename Range::value_type number,
const Range &u)
666template <
typename Range,
typename Domain,
typename Payload>
677 return_comp.
apply = [op, &u](Range &v) { op.
vmult(v, u); };
701template <
typename Range,
typename Domain,
typename Payload>
712 return_comp.
apply = [op, &u](Domain &v) { op.
Tvmult(v, u); };
728template <
typename Range,
typename Domain,
typename Payload>
740 return_comp.
apply = [op, comp](Domain &v) {
750 return_comp.
apply_add = [op, comp](Domain &v) {
772template <
typename Range,
typename Domain,
typename Payload>
784 return_comp.
apply = [op, comp](Domain &v) {
794 return_comp.
apply_add = [op, comp](Domain &v) {
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
PackagedOperation< Range > & operator*=(typename Range::value_type number)
PackagedOperation< Range > & operator=(const Range &u)
PackagedOperation(const Range &u)
std::function< void(Range &v)> apply
PackagedOperation< Range > & operator=(const PackagedOperation< Range > &)=default
PackagedOperation< Range > & operator+=(const PackagedOperation< Range > &second_comp)
std::function< void(Range &v)> apply_add
PackagedOperation< Range > & operator-=(const Range &offset)
PackagedOperation(const PackagedOperation< Range > &)=default
PackagedOperation< Range > & operator+=(const Range &offset)
PackagedOperation< Range > & operator-=(const PackagedOperation< Range > &second_comp)
static std::true_type test(decltype(&C::operator+=), decltype(&C::operator-=), decltype(&C::l2_norm))
static std::false_type test(...)
decltype(test< T >(nullptr, nullptr, nullptr)) type
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
PackagedOperation< Range > operator*(const LinearOperator< Range, Domain, Payload > &op, const PackagedOperation< Domain > &comp)
PackagedOperation< Range > operator-(const PackagedOperation< Range > &comp, const Range &offset)
PackagedOperation< Domain > operator*(const PackagedOperation< Range > &comp, const LinearOperator< Range, Domain, Payload > &op)
PackagedOperation< Range > operator-(const Range &u, const Range &v)
PackagedOperation< Range > operator*(const LinearOperator< Range, Domain, Payload > &op, const Domain &u)
PackagedOperation< Domain > operator*(const Range &u, const LinearOperator< Range, Domain, Payload > &op)
PackagedOperation< Range > operator+(const Range &offset, const PackagedOperation< Range > &comp)
PackagedOperation< Range > operator*(typename Range::value_type number, const Range &u)
PackagedOperation< Range > operator-(const Range &offset, const PackagedOperation< Range > &comp)
PackagedOperation< Range > operator-(const PackagedOperation< Range > &first_comp, const PackagedOperation< Range > &second_comp)
PackagedOperation< Range > operator+(const PackagedOperation< Range > &comp, const Range &offset)
PackagedOperation< Range > operator+(const Range &u, const Range &v)
PackagedOperation< Range > operator*(const PackagedOperation< Range > &comp, typename Range::value_type number)
PackagedOperation< Range > operator*(typename Range::value_type number, const PackagedOperation< Range > &comp)
PackagedOperation< Range > operator*(const Range &u, typename Range::value_type number)
PackagedOperation< Range > operator+(const PackagedOperation< Range > &first_comp, const PackagedOperation< Range > &second_comp)