Teko Version of the Day
Loading...
Searching...
No Matches
Teko_ImplicitLinearOp.cpp
1// @HEADER
2// *****************************************************************************
3// Teko: A package for block and physics based preconditioning
4//
5// Copyright 2010 NTESS and the Teko contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#include "Teko_ImplicitLinearOp.hpp"
11
12namespace Teko {
13
14using Teuchos::RCP;
15using Teuchos::rcp_const_cast;
16using Teuchos::rcp_dynamic_cast;
17using Teuchos::rcpFromRef;
18
19using Thyra::MultiVectorBase;
20
21bool ImplicitLinearOp::opSupportedImpl(const Thyra::EOpTransp M_trans) const {
22 return (M_trans == Thyra::NOTRANS);
23}
24
25void ImplicitLinearOp::applyImpl(const Thyra::EOpTransp M_trans,
26 const Thyra::MultiVectorBase<double>& x,
27 const Teuchos::Ptr<Thyra::MultiVectorBase<double> >& y,
28 const double alpha, const double beta) const {
29 TEUCHOS_TEST_FOR_EXCEPTION(M_trans != Thyra::NOTRANS, std::runtime_error,
30 "Linear operators of inherited type Teko::ImplicitLinearOp "
31 "cannot handle conjugation (yet!)");
32
33 MultiVector srcX = rcp_const_cast<MultiVectorBase<double> >(rcpFromRef(x));
34 MultiVector destY = rcp_dynamic_cast<MultiVectorBase<double> >(rcpFromRef(*y));
35
36 // call apply
37 implicitApply(srcX, destY, alpha, beta);
38}
39
40} // end namespace Teko
virtual void implicitApply(const MultiVector &x, MultiVector &y, const double alpha=1.0, const double beta=0.0) const =0
Perform a matrix vector multiply with this implicitly defined blocked operator.
virtual bool opSupportedImpl(const Thyra::EOpTransp M_trans) const
Functions required by Thyra::LinearOpBase.