16#ifndef dealii_packaged_operation_h
17#define dealii_packaged_operation_h
31template <
typename Number>
33template <
typename Range,
typename Domain,
typename Payload>
35template <
typename Range = Vector<
double>>
104template <
typename Range>
115 apply = [](Range &) {
118 "Uninitialized PackagedOperation<Range>::apply called"));
124 "Uninitialized PackagedOperation<Range>::apply_add called"));
129 ExcMessage(
"Uninitialized PackagedOperation<Range>::reinit_vector "
171 apply = [&u](Range &v) { v = u; };
176 v.reinit(u, omit_zeroing_entries);
188 operator Range()
const
193 apply(result_vector);
195 return result_vector;
209 *
this = *
this + second_comp;
220 *
this = *
this - second_comp;
252 *
this = *
this * number;
261 std::function<void(Range &v)>
apply;
293template <
typename Range>
305 return_comp.
apply = [first_comp, second_comp](Range &v) {
310 return_comp.
apply_add = [first_comp, second_comp](Range &v) {
326template <
typename Range>
338 return_comp.
apply = [first_comp, second_comp](Range &v) {
339 second_comp.
apply(v);
344 return_comp.
apply_add = [first_comp, second_comp](Range &v) {
362template <
typename Range>
365 typename Range::value_type number)
374 return_comp.
apply = [](Range &v) { v = 0.; };
380 return_comp.
apply = [comp, number](Range &v) {
385 return_comp.
apply_add = [comp, number](Range &v) {
403template <
typename Range>
408 return comp * number;
419template <
typename Range>
434template <
typename Range>
449template <
typename Range>
466template <
typename Range>
483 namespace PackagedOperationImplementation
489 template <
typename T>
492 template <
typename C>
493 static std::false_type
496 template <
typename C>
497 static std::true_type
499 decltype(&C::operator-=),
500 decltype(&C::l2_norm));
506 using type =
decltype(test<T>(
nullptr,
nullptr,
nullptr));
526template <
typename Range,
527 typename =
typename std::enable_if<
529 Range>::type::value>::type>
538 return_comp.
reinit_vector = [&u](Range &x,
bool omit_zeroing_entries) {
539 x.reinit(u, omit_zeroing_entries);
542 return_comp.
apply = [&u, &v](Range &x) {
547 return_comp.
apply_add = [&u, &v](Range &x) {
571template <
typename Range,
572 typename =
typename std::enable_if<
574 Range>::type::value>::type>
583 return_comp.
reinit_vector = [&u](Range &x,
bool omit_zeroing_entries) {
584 x.reinit(u, omit_zeroing_entries);
587 return_comp.
apply = [&u, &v](Range &x) {
592 return_comp.
apply_add = [&u, &v](Range &x) {
615template <
typename Range,
616 typename =
typename std::enable_if<
618 Range>::type::value>::type>
620operator*(
const Range &u,
typename Range::value_type number)
640template <
typename Range,
641 typename =
typename std::enable_if<
643 Range>::type::value>::type>
645operator*(
typename Range::value_type number,
const Range &u)
667template <
typename Range,
typename Domain,
typename Payload>
678 return_comp.
apply = [op, &u](Range &v) { op.
vmult(v, u); };
702template <
typename Range,
typename Domain,
typename Payload>
713 return_comp.
apply = [op, &u](Domain &v) { op.
Tvmult(v, u); };
729template <
typename Range,
typename Domain,
typename Payload>
741 return_comp.
apply = [op, comp](Domain &v) {
751 return_comp.
apply_add = [op, comp](Domain &v) {
773template <
typename Range,
typename Domain,
typename Payload>
785 return_comp.
apply = [op, comp](Domain &v) {
795 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)