M | linear operator. A list of required member functions for M is shown below. Here RT (typename M::RT ) is either double or float. Examples of implementation for V being a single-component MultiFab are also given below.
void apply(V& Ax, V const& x)
Ax = A(x), where A is the linear operator performing matrix vector product. Here x is made with the makeVecLHS function. Therefore, it may have ghost cells and it's safe to cast it with const_cast<V&>(x) and do ghost cell exchange, if necessary.
void assign(V& lhs, V const& rhs)
lhs = rhs. For example, MultiFab::Copy(lhs,rhs,0,0,1,0) .
RT dotProduct(V const& v1, V const& v2)
returns v1 * v2. For example, MultiFab::Dot(v1,0,v2,0,1,0) .
void increment(V& lhs, V const& rhs, RT a)
lhs += a * rhs. For example, MultiFab::Saxpy(lhs,a,rhs,0,0,1,0) .
void linComb(V& lhs, RT a, V const& rhs_a, RT b, V const& rhs_b)
lhs = a * rhs_a + b * rhs_b. For example, MultiFab::LinComb(lhs,a,rhs_a,0,b,rhs_b,0,0,1,0) .
V makeVecRHS()
returns a V object that is suitable as RHS in M x = b. The reason we distinguish between LHS and RHS is M might need the distinction for efficiency. For example, if V is MultiFab, we might need the x in the LHS of M x = b to have ghost cells for efficiency, whereas no ghost cells are needed for the RHS (i.e., b). An example of the implementation might be return MultiFab(grids,dmap,1,0) .
V makeVecLHS()
returns a V object that is suitable as LHS in M x = b. See the description for makeVecRHS for more details. An example of the implementation might be return MultiFab(grids,dmap,1,1) .
RT norm2(V const& v)
returns the 2-norm of v. For example, return v.norm2() .
void precond(V& lhs, V const& rhs)
applies right-preconditioning, i.e., solve P(lhs) = rhs, where P is an approximation to A If there is no preconditioner, P = I and thus this function should do lhs = rhs.
void scale(V& v, RT fac)
scales v by fac. For example, v.mult(fac) .
void setToZero(V& v)
v = 0. For example, v.setVal(0) .
|