10 #include "Teko_BlockLowerTriInverseOp.hpp"
12 #include "Teuchos_Utils.hpp"
18 BlockLowerTriInverseOp::BlockLowerTriInverseOp(BlockedLinearOp& L,
19 const std::vector<LinearOp>& invDiag)
24 int blocks = blockRowCount(
L_);
25 TEUCHOS_ASSERT(blocks > 0);
26 TEUCHOS_ASSERT(blocks == blockColCount(
L_));
27 TEUCHOS_ASSERT(blocks == (
int)
invDiag_.size());
50 const double alpha,
const double beta)
const {
51 int blocks = blockCount(src);
53 TEUCHOS_ASSERT(blocks == blockRowCount(
L_));
54 TEUCHOS_ASSERT(blocks == blockCount(dst));
57 srcScrap_ = deepcopy(src);
58 dstScrap_ = deepcopy(dst);
63 Thyra::assign<double>(srcScrap_.ptr(), *src);
64 BlockedMultiVector dstCopy;
66 Thyra::assign<double>(dstScrap_.ptr(), *dst);
73 std::vector<MultiVector> dstVec;
74 std::vector<MultiVector> scrapVec;
75 for (
int b = 0; b < blocks; b++) {
76 dstVec.push_back(getBlock(b, dstCopy));
77 scrapVec.push_back(getBlock(b, srcScrap_));
82 for (
int b = 0; b < blocks; b++) {
83 applyOp(
invDiag_[b], scrapVec[b], dstVec[b]);
86 for (
int i = b + 1; i < blocks; i++) {
87 LinearOp u_ib = getBlock(i, b,
L_);
88 if (u_ib != Teuchos::null) {
89 applyOp(u_ib, dstVec[b], scrapVec[i], -1.0, 1.0);
96 update(alpha, dstCopy, beta, dst);
97 else if (alpha != 1.0)
101 void BlockLowerTriInverseOp::describe(Teuchos::FancyOStream& out_arg,
102 const Teuchos::EVerbosityLevel verbLevel)
const {
103 using Teuchos::OSTab;
105 RCP<Teuchos::FancyOStream> out = rcp(&out_arg,
false);
108 case Teuchos::VERB_DEFAULT:
109 case Teuchos::VERB_LOW: *out << this->description() << std::endl;
break;
110 case Teuchos::VERB_MEDIUM:
111 case Teuchos::VERB_HIGH:
112 case Teuchos::VERB_EXTREME: {
113 *out << Teuchos::Describable::description() <<
"{"
114 <<
"rangeDim=" << this->
range()->dim() <<
",domainDim=" << this->
domain()->dim()
115 <<
",rows=" << blockRowCount(
L_) <<
",cols=" << blockColCount(
L_) <<
"}\n";
118 *out <<
"[L Operator] = ";
119 *out << Teuchos::describe(*
L_, verbLevel);
123 *out <<
"[invDiag Operators]:\n";
125 for (
int i = 0; i < blockRowCount(
L_); i++) {
126 *out <<
"[invD(" << i <<
")] = ";
127 *out << Teuchos::describe(*
invDiag_[i], verbLevel);
132 default: TEUCHOS_TEST_FOR_EXCEPT(
true);
virtual VectorSpace domain() const
Domain space of this operator.
const BlockedLinearOp L_
operator
Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > productDomain_
Domain vector space.
virtual void implicitApply(const BlockedMultiVector &x, BlockedMultiVector &y, const double alpha=1.0, const double beta=0.0) const
Perform a matrix vector multiply with this operator.
std::vector< LinearOp > invDiag_
(Approximate) Inverses of the diagonal operators
Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > productRange_
Range vector space.
virtual VectorSpace range() const
Range space of this operator.