16 #ifndef dealii_packaged_operation_h 17 #define dealii_packaged_operation_h 19 #include <deal.II/base/config.h> 20 #include <deal.II/base/exceptions.h> 21 #include <deal.II/lac/vector_memory.h> 25 DEAL_II_NAMESPACE_OPEN
28 template <
typename Number>
class Vector;
29 template <
typename Range,
typename Domain,
typename Payload>
class LinearOperator;
109 ExcMessage(
"Uninitialized PackagedOperation<Range>::apply called"));
115 ExcMessage(
"Uninitialized PackagedOperation<Range>::apply_add called"));
121 ExcMessage(
"Uninitialized PackagedOperation<Range>::reinit_vector " 161 apply = [&u](Range &v)
173 v.reinit(u, omit_zeroing_entries);
185 operator Range()
const 190 apply(result_vector);
192 return result_vector;
205 *
this = *
this + second_comp;
215 *
this = *
this - second_comp;
244 *
this = *
this * number;
253 std::function<void(Range &v)>
apply;
285 template <
typename Range>
297 return_comp.
apply = [first_comp, second_comp](Range &v)
303 return_comp.
apply_add = [first_comp, second_comp](Range &v)
320 template <
typename Range>
332 return_comp.
apply = [first_comp, second_comp](Range &v)
334 second_comp.
apply(v);
339 return_comp.
apply_add = [first_comp, second_comp](Range &v)
358 template <
typename Range>
361 typename Range::value_type number)
370 return_comp.
apply = [](Range &v)
381 return_comp.
apply = [comp, number](Range &v)
387 return_comp.
apply_add = [comp, number](Range &v)
406 template <
typename Range>
411 return comp * number;
422 template <
typename Range>
437 template <
typename Range>
452 template <
typename Range>
469 template <
typename Range>
490 template <
typename T>
491 class has_vector_interface
493 template <
typename C>
494 static std::false_type test(...);
496 template <
typename C>
497 static std::true_type test(decltype(&C::operator+=),
498 decltype(&C::operator-=),
499 decltype(&C::l2_norm));
505 typedef decltype(test<T>(
nullptr,
nullptr,
nullptr)) type;
524 template <typename Range,
525 typename = typename
std::enable_if<has_vector_interface<Range>::type::value>::type>
533 return_comp.
reinit_vector = [&u](Range &x,
bool omit_zeroing_entries)
535 x.reinit(u, omit_zeroing_entries);
538 return_comp.
apply = [&u, &v](Range &x)
544 return_comp.
apply_add = [&u, &v](Range &x)
569 template <
typename Range,
570 typename =
typename std::enable_if<has_vector_interface<Range>::type::value>::type>
578 return_comp.
reinit_vector = [&u](Range &x,
bool omit_zeroing_entries)
580 x.reinit(u, omit_zeroing_entries);
583 return_comp.
apply = [&u, &v](Range &x)
589 return_comp.
apply_add = [&u, &v](Range &x)
613 template <
typename Range,
614 typename =
typename std::enable_if<has_vector_interface<Range>::type::value>::type>
616 typename Range::value_type number)
636 template <
typename Range,
637 typename =
typename std::enable_if<has_vector_interface<Range>::type::value>::type>
661 template <
typename Range,
typename Domain,
typename Payload>
673 return_comp.
apply = [op, &u](Range &v)
678 return_comp.
apply_add = [op, &u](Range &v)
703 template <
typename Range,
typename Domain,
typename Payload>
715 return_comp.
apply = [op, &u](Domain &v)
720 return_comp.
apply_add = [op, &u](Domain &v)
737 template <
typename Range,
typename Domain,
typename Payload>
749 return_comp.
apply = [op, comp](Domain &v)
760 return_comp.
apply_add = [op, comp](Domain &v)
783 template <
typename Range,
typename Domain,
typename Payload>
795 return_comp.
apply = [op, comp](Domain &v)
806 return_comp.
apply_add = [op, comp](Domain &v)
822 DEAL_II_NAMESPACE_CLOSE
PackagedOperation< Range > & operator+=(const PackagedOperation< Range > &second_comp)
PackagedOperation(const Range &u)
std::function< void(Range &v)> apply
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
PackagedOperation< Range > & operator-=(const PackagedOperation< Range > &second_comp)
SymmetricTensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+(const SymmetricTensor< rank_, dim, Number > &left, const SymmetricTensor< rank_, dim, OtherNumber > &right)
SymmetricTensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator-(const SymmetricTensor< rank_, dim, Number > &left, const SymmetricTensor< rank_, dim, OtherNumber > &right)
PackagedOperation< Range > & operator=(const PackagedOperation< Range > &)=default
static ::ExceptionBase & ExcMessage(std::string arg1)
PackagedOperation< Range > & operator=(const Range &u)
#define Assert(cond, exc)
std::function< void(Range &v, const Domain &u)> vmult
PackagedOperation< Range > operator-(const PackagedOperation< Range > &first_comp, const PackagedOperation< Range > &second_comp)
std::function< void(Domain &v, bool omit_zeroing_entries)> reinit_domain_vector
PackagedOperation< Range > & operator*=(typename Range::value_type number)
std::function< void(Range &v)> apply_add
std::function< void(Range &v, const Domain &u)> vmult_add
PackagedOperation< Range > & operator+=(const Range &offset)
PackagedOperation< Range > operator*(const PackagedOperation< Range > &comp, typename Range::value_type number)
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber) const
PackagedOperation< Range > & operator-=(const Range &offset)