Reference documentation for deal.II version 9.0.0
|
#include <deal.II/lac/packaged_operation.h>
Public Member Functions | |
PackagedOperation () | |
PackagedOperation (const PackagedOperation< Range > &)=default | |
PackagedOperation (const Range &u) | |
PackagedOperation< Range > & | operator= (const PackagedOperation< Range > &)=default |
PackagedOperation< Range > & | operator= (const Range &u) |
operator Range () const | |
In-place vector space operations | |
PackagedOperation< Range > & | operator+= (const PackagedOperation< Range > &second_comp) |
PackagedOperation< Range > & | operator-= (const PackagedOperation< Range > &second_comp) |
PackagedOperation< Range > & | operator+= (const Range &offset) |
PackagedOperation< Range > & | operator-= (const Range &offset) |
PackagedOperation< Range > & | operator*= (typename Range::value_type number) |
Public Attributes | |
std::function< void(Range &v)> | apply |
std::function< void(Range &v)> | apply_add |
std::function< void(Range &v, bool omit_zeroing_entries)> | reinit_vector |
Related Functions | |
(Note that these are not member functions.) | |
Vector space operations | |
template<typename Range > | |
PackagedOperation< Range > | operator+ (const PackagedOperation< Range > &first_comp, const PackagedOperation< Range > &second_comp) |
template<typename Range > | |
PackagedOperation< Range > | operator- (const PackagedOperation< Range > &first_comp, const PackagedOperation< Range > &second_comp) |
template<typename Range > | |
PackagedOperation< Range > | operator* (const PackagedOperation< Range > &comp, typename Range::value_type number) |
template<typename Range > | |
PackagedOperation< Range > | operator* (typename Range::value_type number, const PackagedOperation< Range > &comp) |
template<typename Range > | |
PackagedOperation< Range > | operator+ (const PackagedOperation< Range > &comp, const Range &offset) |
template<typename Range > | |
PackagedOperation< Range > | operator+ (const Range &offset, const PackagedOperation< Range > &comp) |
template<typename Range > | |
PackagedOperation< Range > | operator- (const PackagedOperation< Range > &comp, const Range &offset) |
template<typename Range > | |
PackagedOperation< Range > | operator- (const Range &offset, const PackagedOperation< Range > &comp) |
Creation of a PackagedOperation object | |
template<typename Range , typename = typename std::enable_if<has_vector_interface<Range>::type::value>::type> | |
PackagedOperation< Range > | operator+ (const Range &u, const Range &v) |
template<typename Range , typename = typename std::enable_if<has_vector_interface<Range>::type::value>::type> | |
PackagedOperation< Range > | operator- (const Range &u, const Range &v) |
template<typename Range , typename = typename std::enable_if<has_vector_interface<Range>::type::value>::type> | |
PackagedOperation< Range > | operator* (const Range &u, typename Range::value_type number) |
template<typename Range , typename = typename std::enable_if<has_vector_interface<Range>::type::value>::type> | |
PackagedOperation< Range > | operator* (typename Range::value_type number, const Range &u) |
template<typename Range , typename Domain , typename Payload > | |
PackagedOperation< Range > | operator* (const LinearOperator< Range, Domain, Payload > &op, const Domain &u) |
template<typename Range , typename Domain , typename Payload > | |
PackagedOperation< Domain > | operator* (const Range &u, const LinearOperator< Range, Domain, Payload > &op) |
template<typename Range , typename Domain , typename Payload > | |
PackagedOperation< Range > | operator* (const LinearOperator< Range, Domain, Payload > &op, const PackagedOperation< Domain > &comp) |
template<typename Range , typename Domain , typename Payload > | |
PackagedOperation< Domain > | operator* (const PackagedOperation< Range > &comp, const LinearOperator< Range, Domain, Payload > &op) |
Creation of PackagedOperation objects related to the Schur Complement | |
template<typename Range_1 , typename Domain_1 , typename Range_2 , typename Payload > | |
PackagedOperation< Range_2 > | condense_schur_rhs (const LinearOperator< Range_1, Domain_1, Payload > &A_inv, const LinearOperator< Range_2, Domain_1, Payload > &C, const Range_1 &f, const Range_2 &g) |
template<typename Range_1 , typename Domain_1 , typename Domain_2 , typename Payload > | |
PackagedOperation< Domain_1 > | postprocess_schur_solution (const LinearOperator< Range_1, Domain_1, Payload > &A_inv, const LinearOperator< Range_1, Domain_2, Payload > &B, const Domain_2 &y, const Range_1 &f) |
A class to store a computation.
The PackagedOperation class allows lazy evaluation of expressions involving vectors and linear operators. This is done by storing the computational expression and only performing the computation when either the object is implicitly converted to a vector object, or apply
(or apply_add
) is invoked by hand. This avoids unnecessary temporary storage of intermediate results.
The class essentially consists of std::function
objects that store the knowledge of how to generate the result of a computation and store it in a vector:
Similar to the LinearOperator class it also has knowledge about how to initialize a vector of the Range
space:
As an example consider the addition of multiple vectors
or the computation of a residual \(b-Ax\):
The expression residual
is of type PackagedOperation<Vector<double>>
. It stores references to A
, b
and x
and defers the actual computation until apply
, or apply_add
are explicitly invoked,
or until the PackagedOperation
object is implicitly converted:
Definition at line 30 of file packaged_operation.h.
|
inline |
Create an empty PackagedOperation object. All std::function
member objects are initialized with default variants that throw an exception upon invocation.
Definition at line 104 of file packaged_operation.h.
|
default |
Default copy constructor.
|
inline |
Constructor that creates a PackagedOperation object from a reference vector u
. The PackagedOperation returns u
.
The PackagedOperation object that is created stores a reference to u
. Thus, the vector must remain a valid reference for the whole lifetime of the PackagedOperation object. All changes made on u
after the creation of the PackagedOperation object are reflected by the operator object.
Definition at line 140 of file packaged_operation.h.
|
default |
Default copy assignment operator.
|
inline |
Copy assignment operator that creates a PackagedOperation object from a reference vector u
. The PackagedOperation returns u
.
The PackagedOperation object that is created stores a reference to u
. Thus, the vector must remain a valid reference for the whole lifetime of the PackagedOperation object. All changes made on u
after the creation of the PackagedOperation object are reflected by the operator object.
Definition at line 159 of file packaged_operation.h.
|
inline |
Convert a PackagedOperation to its result.
This conversion operator creates a vector of the Range space and calls apply()
on it.
Definition at line 185 of file packaged_operation.h.
|
inline |
Addition with a PackagedOperation second_comp
with the same Range
.
Definition at line 203 of file packaged_operation.h.
|
inline |
Subtraction with a PackagedOperation second_comp
with the same Range
.
Definition at line 213 of file packaged_operation.h.
|
inline |
Add a constant offset
(of the Range
space) to the result of a PackagedOperation.
Definition at line 223 of file packaged_operation.h.
|
inline |
Subtract a constant offset
(of the Range
space) from the result of a PackagedOperation.
Definition at line 233 of file packaged_operation.h.
|
inline |
Scalar multiplication of the PackagedOperation with a number
.
Definition at line 242 of file packaged_operation.h.
std::function<void(Range &v)> PackagedOperation< Range >::apply |
Store the result of the PackagedOperation in a vector v of the Range
space.
Definition at line 253 of file packaged_operation.h.
std::function<void(Range &v)> PackagedOperation< Range >::apply_add |
Add the result of the PackagedOperation to a vector v of the Range
space.
Definition at line 259 of file packaged_operation.h.
std::function<void(Range &v, bool omit_zeroing_entries)> PackagedOperation< Range >::reinit_vector |
Initializes a vector v of the Range space to be directly usable as the destination parameter in an application of apply, or apply_add. Similar to the reinit functions of the vector classes, the boolean determines whether a fast initialization is done, i.e., if it is set to false the content of the vector is set to 0.
Definition at line 268 of file packaged_operation.h.